Issues

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

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).

This has been duplicated by ZF-7207 (http://tinyurl.com/lqyqym) and has now been resolved.