From: Operating system: Ubuntu 10.04 PHP version: 5.3.2 Package: SPL related Bug Type: Bug Bug description:ArrayIterator::rewind() doesn't rewind to first element, but to second.
Description: ------------ ArrayIterator::rewind() doesn't rewind to first element, but to second. Test script: --------------- <?php $i = new ArrayIterator(array(1,2,3,4,5,6)); $r = false; # To prevent looping infinitely. foreach($i as $j) { if ($j == 4 && $r == false) { $i->rewind(); $r = true; } echo $j.","; } Expected result: ---------------- 1,2,3,4,1,2,3,4,5,6, Actual result: -------------- 1,2,3,4,2,3,4,5,6, -- Edit bug report at http://bugs.php.net/bug.php?id=51942&edit=1 -- Try a snapshot (PHP 5.2): http://bugs.php.net/fix.php?id=51942&r=trysnapshot52 Try a snapshot (PHP 5.3): http://bugs.php.net/fix.php?id=51942&r=trysnapshot53 Try a snapshot (trunk): http://bugs.php.net/fix.php?id=51942&r=trysnapshottrunk Fixed in SVN: http://bugs.php.net/fix.php?id=51942&r=fixed Fixed in SVN and need be documented: http://bugs.php.net/fix.php?id=51942&r=needdocs Fixed in release: http://bugs.php.net/fix.php?id=51942&r=alreadyfixed Need backtrace: http://bugs.php.net/fix.php?id=51942&r=needtrace Need Reproduce Script: http://bugs.php.net/fix.php?id=51942&r=needscript Try newer version: http://bugs.php.net/fix.php?id=51942&r=oldversion Not developer issue: http://bugs.php.net/fix.php?id=51942&r=support Expected behavior: http://bugs.php.net/fix.php?id=51942&r=notwrong Not enough info: http://bugs.php.net/fix.php?id=51942&r=notenoughinfo Submitted twice: http://bugs.php.net/fix.php?id=51942&r=submittedtwice register_globals: http://bugs.php.net/fix.php?id=51942&r=globals PHP 4 support discontinued: http://bugs.php.net/fix.php?id=51942&r=php4 Daylight Savings: http://bugs.php.net/fix.php?id=51942&r=dst IIS Stability: http://bugs.php.net/fix.php?id=51942&r=isapi Install GNU Sed: http://bugs.php.net/fix.php?id=51942&r=gnused Floating point limitations: http://bugs.php.net/fix.php?id=51942&r=float No Zend Extensions: http://bugs.php.net/fix.php?id=51942&r=nozend MySQL Configuration Error: http://bugs.php.net/fix.php?id=51942&r=mysqlcfg