ZF-3720: Setting the current page number causes the items to be fetched prematurely


Zend_Paginator will break if you set the current page number before setting the item count per page. It seems that setting the page number executes the select query to retrieve the items.

<?php $page = 1; $itemsPerPage = 5; // Not working $paginator = Zend_Paginator::factory($select); $paginator->setCurrentPageNumber($page); $paginator->setItemCountPerPage($itemsPerPage); $items = $paginator->getItems(); // Incorrectly returns 10 items (the default count per page) // This works $paginator = Zend_Paginator::factory($select); $paginator->setItemCountPerPage($itemsPerPage); $paginator->setCurrentPageNumber($page); // Must be done last $items = $paginator->getItems(); // Correctly returns 5 items ?>


Fixed in revision 10307