ZF-9213: Zend_Db_Table_Rowset returns empty Zend_Db_Table_Row when acess negative index

Issue Type: Bug Created: 2010-02-19T06:44:35.000+0000 Last Updated: 2010-07-17T08:05:04.000+0000 Status: Resolved Fix version(s): - 1.10.7 (28/Jul/10)

Reporter: Reinaldo Mendes (reinaldomendes) Assignee: Ramon Henrique Ornelas (ramon) Tags: - Zend_Db_Table

Related issues: - ZF-10173



When acess negative index in rowset it should return null, because offset is inválid,but returns a row without data. if access any position of a empty row it throws an exception.


$table = new My_Table();//any table implementation $rowset = $table->fetchAll();//return rowset $row = $rowset[-1];//shold return null, but returns a Row without data


Posted by Ramon Henrique Ornelas (ramon) on 2010-02-19T07:03:34.000+0000

Current Code in Zend_Db_Table_Rowset_Abstract

<pre class="highlight">
public function valid()
        return $this->_pointer < $this->_count;

Should be

<pre class="highlight">
public function valid()
        return $this->_pointer >= 0 && $this->_pointer < $this->_count;

Posted by Ramon Henrique Ornelas (ramon) on 2010-07-16T12:53:31.000+0000

Fixed with the r22582.

Have you found an issue?

See the Overview section for more details.


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