Issues

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

Description

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.

Ex:

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

Comments

Current Code in Zend_Db_Table_Rowset_Abstract


public function valid()
{
        return $this->_pointer < $this->_count;
}

Should be


public function valid()
{
        return $this->_pointer >= 0 && $this->_pointer < $this->_count;
}

Fixed with the r22582.