Bladeren bron

[ZF-6748]if index of row equals count of rows, exception is needed.

git-svn-id: http://framework.zend.com/svn/framework/standard/trunk@15817 44c647ce-9c0f-0410-b52a-842ac1e357ba
yoshida@zend.co.jp 16 jaren geleden
bovenliggende
commit
5eeb418a26
1 gewijzigde bestanden met toevoegingen van 8 en 8 verwijderingen
  1. 8 8
      library/Zend/Db/Table/Rowset/Abstract.php

+ 8 - 8
library/Zend/Db/Table/Rowset/Abstract.php

@@ -127,7 +127,7 @@ abstract class Zend_Db_Table_Rowset_Abstract implements SeekableIterator, Counta
 
         // set the count of rows
         $this->_count = count($this->_data);
-        
+
         $this->init();
     }
 
@@ -308,7 +308,7 @@ abstract class Zend_Db_Table_Rowset_Abstract implements SeekableIterator, Counta
     {
         return $this->_count;
     }
-    
+
     /**
      * Take the Iterator to position $position
      * Required by interface SeekableIterator.
@@ -320,14 +320,14 @@ abstract class Zend_Db_Table_Rowset_Abstract implements SeekableIterator, Counta
     public function seek($position)
     {
         $position = (int) $position;
-        if ($position < 0 || $position > $this->_count) {
+        if ($position < 0 || $position >= $this->_count) {
             require_once 'Zend/Db/Table/Rowset/Exception.php';
             throw new Zend_Db_Table_Rowset_Exception("Illegal index $position");
         }
         $this->_pointer = $position;
-        return $this;        
+        return $this;
     }
-    
+
     /**
      * Check if an offset exists
      * Required by the ArrayAccess implementation
@@ -339,7 +339,7 @@ abstract class Zend_Db_Table_Rowset_Abstract implements SeekableIterator, Counta
     {
         return isset($this->_data[(int) $offset]);
     }
-    
+
     /**
      * Get the row for the given offset
      * Required by the ArrayAccess implementation
@@ -353,7 +353,7 @@ abstract class Zend_Db_Table_Rowset_Abstract implements SeekableIterator, Counta
 
         return $this->current();
     }
-    
+
     /**
      * Does nothing
      * Required by the ArrayAccess implementation
@@ -364,7 +364,7 @@ abstract class Zend_Db_Table_Rowset_Abstract implements SeekableIterator, Counta
     public function offsetSet($offset, $value)
     {
     }
-    
+
     /**
      * Does nothing
      * Required by the ArrayAccess implementation