ID:               47497
 User updated by:  doctorrock83 at gmail dot com
 Reported By:      doctorrock83 at gmail dot com
 Status:           Open
 Bug Type:         SPL related
 Operating System: Win32
 PHP Version:      5.2.8
 New Comment:

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


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

[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