Issues

ZF-11672: Paginator SerializableLimitIterator throws OutOfBoundsException

Issue Type: Bug Created: 2011-08-16T10:13:05.000+0000 Last Updated: 2011-08-16T10:16:29.000+0000 Status: Open Fix version(s): Reporter: Christian Opitz (metti) Assignee: Jurrien Stutterheim (norm2782) Tags: - Zend_Paginator

Related issues: Attachments:

Description

When Session is enabled i get the following exception from Zend_Paginator_SerializableLimitIterator:

<pre class="highlight">
Uncaught exception 'OutOfBoundsException' with message 'Cannot seek to 10 which is behind offset 0 plus count 10' in C:\Zend\ZendServer\share\ZendFramework\library\Zend\Paginator\SerializableLimitIterator.php:80
Stack trace:
#0 C:\Zend\ZendServer\share\ZendFramework\library\Zend\Paginator\SerializableLimitIterator.php(80): LimitIterator->seek(10)
#1 [internal function]: Zend_Paginator_SerializableLimitIterator->unserialize('a:4:{s:2:"it";O...')
#2 C:\Zend\ZendServer\share\ZendFramework\library\Zend\Session.php(480): session_start()
#3 C:\Zend\Apache2\htdocs\pikee_zf\application\Bootstrap.php(12): Zend_Session::start()
#4 C:\Zend\ZendServer\share\ZendFramework\library\Zend\Application\Bootstrap\BootstrapAbstract.php(667): Bootstrap->_initSession()
#5 C:\Zend\ZendServer\share\ZendFramework\library\Zend\Application\Bootstrap\BootstrapAbstract.php(620): Zend_Application_Bootstrap_BootstrapAbstract->_executeResource('session')
#6 C:\Zend\ZendServer\share\ZendFramework\library\Zend\Application\Bootstrap\BootstrapAb in <b>C:\Zend\ZendServer\share\ZendFramework\library\Zend\Paginator\SerializableLimitIterator.php
</b>

I guess the reason is that Zend_Paginator_SerializableLimitIterator tries to seek to 10 when there are only ten items - instead it should seek to 9. Fixed that in the attached patch.

Comments

Posted by Christian Opitz (metti) on 2011-08-16T10:16:29.000+0000

Hmm - could not find where to upload the patch - so here it is:

<pre class="highlight">
80c80
<         $this->seek($dataArr['pos']+$dataArr['offset']);
---
>         $this->seek(min($dataArr['pos']+$dataArr['offset'], $dataArr['count'] - 1));

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