#42279 [Opn->Bgs]: LimitIterator doesn't follow Iterator contract

From: Date: Sun, 12 Aug 2007 15:24:55 +0000
Subject: #42279 [Opn->Bgs]: LimitIterator doesn't follow Iterator contract
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-115996@lists.php.net to get a copy of this message
ID: 42279 Updated by: johannes@php.net Reported By: michiel at worthit dot nl -Status: Open +Status: Bogus Bug Type: SPL related Operating System: Any PHP Version: 5CVS-2007-08-12 (snap) New Comment: Thank you for taking the time to write to us, but this is not a bug. Please double-check the documentation available at http://www.php.net/manual/ and the instructions on how to report a bug at http://bugs.php.net/how-to-report.php You have to call rewind() before accessing current(), without calling rewind() the current value is undefined. Previous Comments: ------------------------------------------------------------------------ [2007-08-12 15:13:16] michiel at worthit dot nl Description: ------------ The LimitIterator doesn't seem to follow the Iterator contract: It's not possible to iterate using the Iterator methods. Reproduce code: --------------- $limitIterator = new LimitIterator(new ArrayIterator(array('foo'))); $arrayIterator = new ArrayIterator(array('foo')); $limitItValue = $limitIterator->current(); $arrayItValue = $arrayIterator->current(); Expected result: ---------------- $limitItValue and $arrayItValue to be equal (both 'foo') Actual result: -------------- $limitItValue ends up being NULL, while $arrayItValue has the expected value 'foo'. ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=42279&edit=1

« previous php.bugs (#115996) next »