From d7fbda5c30faae0859e59e783cb1ea772e98532d Mon Sep 17 00:00:00 2001 From: Silvio Date: Thu, 26 Aug 2010 16:52:22 -0300 Subject: Boundary fix at IsisMainItemIterator --- classes/iterators/IsisEntryIterator.php | 2 +- classes/iterators/IsisMainItemIterator.php | 6 ++++-- 2 files changed, 5 insertions(+), 3 deletions(-) (limited to 'classes/iterators') diff --git a/classes/iterators/IsisEntryIterator.php b/classes/iterators/IsisEntryIterator.php index feacf89..6a1d72c 100644 --- a/classes/iterators/IsisEntryIterator.php +++ b/classes/iterators/IsisEntryIterator.php @@ -61,6 +61,6 @@ class IsisEntryIterator implements Iterator * Check if there is a current element after calls to rewind() or next(). */ function valid() { - return $this->entry < $this->entries; + return $this->entry <= $this->entries; } } diff --git a/classes/iterators/IsisMainItemIterator.php b/classes/iterators/IsisMainItemIterator.php index 2c1784a..7db95ef 100644 --- a/classes/iterators/IsisMainItemIterator.php +++ b/classes/iterators/IsisMainItemIterator.php @@ -48,7 +48,9 @@ class IsisMainItemIterator implements Iterator */ function current() { $field = $this->class->getMainItemName($this->field); - return $this->valueset[$this->row][$field]; + if (isset($this->valueset[$this->row])) { + return $this->valueset[$this->row][$field]; + } } /** @@ -65,7 +67,7 @@ class IsisMainItemIterator implements Iterator * Check if there are more rows. */ function has_more_rows() { - return $this->row < $this->rows - 1; + return $this->row < $this->rows; } /** -- cgit v1.2.3