Issues

ZF-8656: getPagesInRange($lowerBound, $upperBound) gets floats passed instead of int

Issue Type: Bug Created: 2009-12-29T07:14:31.000+0000 Last Updated: 2010-05-23T02:18:03.000+0000 Status: Resolved Fix version(s): - 1.9.8 (01/Apr/10)

  • 1.10.4 (28/Apr/10)

Reporter: flaves forward (tomx) Assignee: Wil Moore III (wilmoore) (wilmoore) Tags: - Zend_Paginator

Related issues: Attachments: - ZF-8656.patch

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

Have you found an issue?

See the Overview section for more details.

Copyright

© 2006-2016 by Zend, a Rogue Wave Company. Made with by awesome contributors.

This website is built using zend-expressive and it runs on PHP 7.

Contacts