ZF-8656: getPagesInRange($lowerBound, $upperBound) gets floats passed instead of int
Description
the function getPagesInRange($lowerBound, $upperBound) gets sometimes passed float type arguments instead of int's. this causes the function to never complete because the the for loop never reaches its exit-condition.
system: win32 vista / php 5.3.0 / apache 2.2.11 / mysqld (various versions)
Comments
Posted by flaves forward (tomx) on 2009-12-29T07:15:39.000+0000
an int - typecast in the style of: $lowerBound = $this->normalizePageNumber( (int)$lowerBound); $upperBound = $this->normalizePageNumber( (int)$upperBound); solves the issue.
Posted by Wil Moore III (wilmoore) (wilmoore) on 2010-05-22T09:55:52.000+0000
Modified methods normalizeItemNumber() and normalizePageNumber() adding an integer cast which forces all into into an integer (e.g. 1.5 => 1). Also added two unit tests checking return values when given float values as input for normalizeItemNumber() and normalizePageNumber().
Posted by Wil Moore III (wilmoore) (wilmoore) on 2010-05-22T10:22:46.000+0000
Patch applied: Modified methods normalizeItemNumber() and normalizePageNumber() adding an integer cast which forces all into into an integer (e.g. 1.5 => 1). Also added two unit tests checking return values when given float values as input for normalizeItemNumber() and normalizePageNumber().
Implemented with r22257.
Posted by Wil Moore III (wilmoore) (wilmoore) on 2010-05-23T02:17:57.000+0000
merged into branches/release-1.9 and branches/release-1.10