ID:               47497
 Updated by:       j...@php.net
 Reported By:      doctorrock83 at gmail dot com
-Status:           Open
+Status:           Verified
 Bug Type:         SPL related
-Operating System: Win32
+Operating System: *
-PHP Version:      5.2.8
+PHP Version:      5.*, 6CVS (2009-04-30)


Previous Comments:
------------------------------------------------------------------------

[2009-02-24 16:34:31] doctorrock83 at gmail dot com

"Expected result" is 
'a' and TRUE 
and not
1 and TRUE
as you might have guessed

------------------------------------------------------------------------

[2009-02-24 16:31:36] doctorrock83 at gmail dot com

Description:
------------
CachingIterator doesn't work if its innerIterator is an instance of
IteratorIterator.

The use-case provided here might seem strange as the IteratorIterator
is not necessary.
However, it would become necessary for a use case dealing with a
Traversable class such as PDOStatement, and the bug stays the same.

Additionnaly, we actually have to call next() manually but it should be
called internaly.
This leads to another bug which has already been reported at #46227

Reproduce code:
---------------
$it = new ArrayIterator(range('a','z');
$cache = new CachingIterator(new IteratorIterator($it));
$cache->next();
var_dump($cache->current());
var_dump($cache->hasNext());

Expected result:
----------------
1 and TRUE

Actual result:
--------------
NULL and FALSE


------------------------------------------------------------------------


-- 
Edit this bug report at http://bugs.php.net/?id=47497&edit=1

Reply via email to