From 0851a6f64a7d7b32a7ee37fc2716a0c911b70c20 Mon Sep 17 00:00:00 2001 From: Peter Cowburn Date: Tue, 7 May 2013 07:13:05 +0000 Subject: [PATCH] Fixed example code: __construct() is not required by SeekableIterator interface, an Iterator must not automatically rewind, A SeekableIterator should not set its position out of bounds -- Provided by ha kre (hanskrentel@yahoo.de) git-svn-id: https://svn.php.net/repository/phpdoc/en/trunk@330180 c90b9560-bf6c-de11-be94-00142212c4b1 --- reference/spl/seekableiterator.xml | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/reference/spl/seekableiterator.xml b/reference/spl/seekableiterator.xml index 9bfd3ed194..612a2c2765 100644 --- a/reference/spl/seekableiterator.xml +++ b/reference/spl/seekableiterator.xml @@ -59,7 +59,7 @@ position = $position; - - if (!$this->valid()) { + if (!isset($this->array[$position]) { throw new OutOfBoundsException("invalid seek position ($position)"); } + + $this->position = $position; } /* Methods required for Iterator interface */ - public function __construct() { - $this->position = 0; - } - public function rewind() { $this->position = 0; }