ZF-7100: Zend_Paginator can raise a divide by 0 warning
Description
If itemCountPerPage is set to 0 or setItemCountPerPage is not called, a divide by 0 warning may be raised.
This could be avoided by either setting some default item count per page, or throwing an exception if the _calculatePageCount method is called without first setting a valid itemCountPerPage.
Throwing an exception should be prefered, as userland code could set the value to 0 if there is incorrect filtering. Relying on a php warning should not be correct however.
Comments
Posted by Frank Groeneveld (frenkel) on 2009-07-02T10:26:07.000+0000
This problem can be resolved by not using _itemCountPerPage in the Paginator, but calling getItemCountPerPage (which will return the default value if none is set).
Posted by Ryan Mauger (bittarman) on 2009-07-07T10:05:34.000+0000
This has been duplicated by ZF-7207 (http://tinyurl.com/lqyqym) and has now been resolved.