From:             doctorrock83 at gmail dot com
Operating system: Win32
PHP version:      5.2.8
PHP Bug Type:     SPL related
Bug description:  CachingIterator doesn't work with an IteratorIterator inside 
it

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 bug report at http://bugs.php.net/?id=47497&edit=1
-- 
Try a CVS snapshot (PHP 5.2):        
http://bugs.php.net/fix.php?id=47497&r=trysnapshot52
Try a CVS snapshot (PHP 5.3):        
http://bugs.php.net/fix.php?id=47497&r=trysnapshot53
Try a CVS snapshot (PHP 6.0):        
http://bugs.php.net/fix.php?id=47497&r=trysnapshot60
Fixed in CVS:                        
http://bugs.php.net/fix.php?id=47497&r=fixedcvs
Fixed in CVS and need be documented: 
http://bugs.php.net/fix.php?id=47497&r=needdocs
Fixed in release:                    
http://bugs.php.net/fix.php?id=47497&r=alreadyfixed
Need backtrace:                      
http://bugs.php.net/fix.php?id=47497&r=needtrace
Need Reproduce Script:               
http://bugs.php.net/fix.php?id=47497&r=needscript
Try newer version:                   
http://bugs.php.net/fix.php?id=47497&r=oldversion
Not developer issue:                 
http://bugs.php.net/fix.php?id=47497&r=support
Expected behavior:                   
http://bugs.php.net/fix.php?id=47497&r=notwrong
Not enough info:                     
http://bugs.php.net/fix.php?id=47497&r=notenoughinfo
Submitted twice:                     
http://bugs.php.net/fix.php?id=47497&r=submittedtwice
register_globals:                    
http://bugs.php.net/fix.php?id=47497&r=globals
PHP 4 support discontinued:          http://bugs.php.net/fix.php?id=47497&r=php4
Daylight Savings:                    http://bugs.php.net/fix.php?id=47497&r=dst
IIS Stability:                       
http://bugs.php.net/fix.php?id=47497&r=isapi
Install GNU Sed:                     
http://bugs.php.net/fix.php?id=47497&r=gnused
Floating point limitations:          
http://bugs.php.net/fix.php?id=47497&r=float
No Zend Extensions:                  
http://bugs.php.net/fix.php?id=47497&r=nozend
MySQL Configuration Error:           
http://bugs.php.net/fix.php?id=47497&r=mysqlcfg

Reply via email to