PropelModelPager's lastPage is a float, not an int #316

omeaart opened this Issue Mar 17, 2012 · 1 comment


None yet
2 participants

omeaart commented Mar 17, 2012

When you use lastPage you expect an int, that is also what the comments say. But it returns a float.
In the init function, the lastPage is set with the ceil() function. It should be converted to an int with a cast.

$this->setLastPage(ceil($this->getNbResults() / $this->getMaxPerPage()));

Should be

$this->setLastPage((int)ceil($this->getNbResults() / $this->getMaxPerPage()));

fzaninotto added a commit to fzaninotto/Propel that referenced this issue Mar 19, 2012

Fix PropelModelPager::getLastPage() return type.
Turns out that PHP's `ceil()` converts a float to an integer but still returns... a float.
The patch forces the return type of `getLastPage()` by casting to integer after calling `ceil()`.

Closes #316.

@willdurand willdurand closed this Mar 26, 2012


This comment has been minimized.

Show comment Hide comment

willdurand Mar 26, 2012


Fixed by PR #317


willdurand commented Mar 26, 2012

Fixed by PR #317

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment