From: quick_defect at yahoo dot com Operating system: redhat PHP version: 5.1.2 PHP Bug Type: SPL related Bug description: CachingIterator do not work well
Description: ------------ I know I did not use the rewind function as usual. But after I did so, the behavior of Iterator seemed went wrong. Reproduce code: --------------- <?php $ary=array("1","2"); $ary_obj=new ArrayObject($ary); $ite=$ary_obj->getIterator(); $c_ite=new CachingIterator($ite); $ite->rewind(); $c_ite->rewind(); for($axx=$ite;$axx->valid();$axx->next()) { var_dump($axx->current()); } echo "*******\n"; $c_ite->rewind(); $ite->rewind(); for($axx=$c_ite;$axx->valid();$axx->next()) { var_dump($axx->current()); } ?> Expected result: ---------------- string(1) "1" string(1) "2" ******* string(1) "1" string(1) "2" Actual result: -------------- string(1) "2" ******* string(1) "1" string(1) "1" string(1) "2" -- Edit bug report at http://bugs.php.net/?id=36132&edit=1 -- Try a CVS snapshot (PHP 4.4): http://bugs.php.net/fix.php?id=36132&r=trysnapshot44 Try a CVS snapshot (PHP 5.1): http://bugs.php.net/fix.php?id=36132&r=trysnapshot51 Try a CVS snapshot (PHP 6.0): http://bugs.php.net/fix.php?id=36132&r=trysnapshot60 Fixed in CVS: http://bugs.php.net/fix.php?id=36132&r=fixedcvs Fixed in release: http://bugs.php.net/fix.php?id=36132&r=alreadyfixed Need backtrace: http://bugs.php.net/fix.php?id=36132&r=needtrace Need Reproduce Script: http://bugs.php.net/fix.php?id=36132&r=needscript Try newer version: http://bugs.php.net/fix.php?id=36132&r=oldversion Not developer issue: http://bugs.php.net/fix.php?id=36132&r=support Expected behavior: http://bugs.php.net/fix.php?id=36132&r=notwrong Not enough info: http://bugs.php.net/fix.php?id=36132&r=notenoughinfo Submitted twice: http://bugs.php.net/fix.php?id=36132&r=submittedtwice register_globals: http://bugs.php.net/fix.php?id=36132&r=globals PHP 3 support discontinued: http://bugs.php.net/fix.php?id=36132&r=php3 Daylight Savings: http://bugs.php.net/fix.php?id=36132&r=dst IIS Stability: http://bugs.php.net/fix.php?id=36132&r=isapi Install GNU Sed: http://bugs.php.net/fix.php?id=36132&r=gnused Floating point limitations: http://bugs.php.net/fix.php?id=36132&r=float No Zend Extensions: http://bugs.php.net/fix.php?id=36132&r=nozend MySQL Configuration Error: http://bugs.php.net/fix.php?id=36132&r=mysqlcfg