Zend Framework

Zend_Db_Table_Rowset returns empty Zend_Db_Table_Row when acess negative index

Details

  • Type: Bug Bug
  • Status: Resolved Resolved
  • Priority: Major Major
  • Resolution: Fixed
  • Affects Version/s: 1.10.1
  • Fix Version/s: 1.10.7
  • Component/s: Zend_Db_Table
  • Labels:
    None

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

Issue Links

Activity

Hide
Ramon Henrique Ornelas added a comment -

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;
}
Show
Ramon Henrique Ornelas added a comment - 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;
}
Hide
Ramon Henrique Ornelas added a comment -

Fixed with the r22582.

Show
Ramon Henrique Ornelas added a comment - Fixed with the r22582.

People

Vote (2)
Watch (1)

Dates

  • Created:
    Updated:
    Resolved: