CodeIgniter
CodeIgniter copied to clipboard
Pagination library cast total_rows to int
On line 357 the check fails sometimes.
if ($this->total_rows === 0 OR $this->per_page === 0)
should be switched to this
if ( (int) $this->total_rows === 0 OR (int) $this->per_page === 0)
I haven't looked into the full source code of the library, but if these variables can be transformed elsewhere it would be a better idea.
This line is intended to check if you've got the default values, which are integers and don't need typecasting. Do you have a more specific case that needs that proposed change?
MySQL returns count as string, so if you're on some page (already going through pagination) then you empty the table you'll still see the "first page" link returned instead of nothing.