From: olympnn at nm dot ru Operating system: Windows XP Sp2 PHP version: 5.0.5 PHP Bug Type: Arrays related Bug description: nested foreach fails when the array was sometime before referenced
Description: ------------ When I execute the code, it seems that the outer foreach is executed only once. When I comment any of lines marked *, the (outer) foreach executes twice. This bug seems to be very like to bug # 21702, but here the situation is much more strange: I do not use $b in foreaches at all! So it's very strange that the foreach behavior differs when the array was referenced sometime or not. Thanks. Reproduce code: --------------- <? $a=array("1","2"); $b=&$a;//* foreach($a as $i){ print($i); foreach($a as $p);//* } ?> Expected result: ---------------- 12 Actual result: -------------- 1 -- Edit bug report at http://bugs.php.net/?id=35106&edit=1 -- Try a CVS snapshot (php4): http://bugs.php.net/fix.php?id=35106&r=trysnapshot4 Try a CVS snapshot (php5.0): http://bugs.php.net/fix.php?id=35106&r=trysnapshot50 Try a CVS snapshot (php5.1): http://bugs.php.net/fix.php?id=35106&r=trysnapshot51 Fixed in CVS: http://bugs.php.net/fix.php?id=35106&r=fixedcvs Fixed in release: http://bugs.php.net/fix.php?id=35106&r=alreadyfixed Need backtrace: http://bugs.php.net/fix.php?id=35106&r=needtrace Need Reproduce Script: http://bugs.php.net/fix.php?id=35106&r=needscript Try newer version: http://bugs.php.net/fix.php?id=35106&r=oldversion Not developer issue: http://bugs.php.net/fix.php?id=35106&r=support Expected behavior: http://bugs.php.net/fix.php?id=35106&r=notwrong Not enough info: http://bugs.php.net/fix.php?id=35106&r=notenoughinfo Submitted twice: http://bugs.php.net/fix.php?id=35106&r=submittedtwice register_globals: http://bugs.php.net/fix.php?id=35106&r=globals PHP 3 support discontinued: http://bugs.php.net/fix.php?id=35106&r=php3 Daylight Savings: http://bugs.php.net/fix.php?id=35106&r=dst IIS Stability: http://bugs.php.net/fix.php?id=35106&r=isapi Install GNU Sed: http://bugs.php.net/fix.php?id=35106&r=gnused Floating point limitations: http://bugs.php.net/fix.php?id=35106&r=float No Zend Extensions: http://bugs.php.net/fix.php?id=35106&r=nozend MySQL Configuration Error: http://bugs.php.net/fix.php?id=35106&r=mysqlcfg