From: dennis at inmarket dot lviv dot ua Operating system: WinXP PHP version: 5.0.1 PHP Bug Type: Zend Engine 2 problem Bug description: two foreach loops in a row produce 2 diff results
Description: ------------ Hey, just DONT CLOSE THE BUG IF YOU DON'T EVEN READ IT! (This is to [EMAIL PROTECTED], who closed bug 31118) here is SIMPLER TEST CASE - no modifications of the array itself - two foreach loops show different contents Reproduce code: --------------- $a = array('key1'=>'value1', 'key2'=>'value2', 'key3'=>'value3'); foreach($a as $k=>&$v) { echo $k . '=' . $v . "\r\n"; } foreach($a as $k=>$v) { echo $k . '=' . $v . "\r\n"; } // See? No values are modified!!! All explanations to other bugs do not cover this problem Expected result: ---------------- key1=value1 key2=value2 key3=value3 key1=value1 key2=value2 key3=value3 Actual result: -------------- key1=value1 key2=value2 key3=value3 key1=value1 key2=value2 key3=value2 <- should be 3 -- Edit bug report at http://bugs.php.net/?id=31125&edit=1 -- Try a CVS snapshot (php4): http://bugs.php.net/fix.php?id=31125&r=trysnapshot4 Try a CVS snapshot (php5.0): http://bugs.php.net/fix.php?id=31125&r=trysnapshot50 Try a CVS snapshot (php5.1): http://bugs.php.net/fix.php?id=31125&r=trysnapshot51 Fixed in CVS: http://bugs.php.net/fix.php?id=31125&r=fixedcvs Fixed in release: http://bugs.php.net/fix.php?id=31125&r=alreadyfixed Need backtrace: http://bugs.php.net/fix.php?id=31125&r=needtrace Need Reproduce Script: http://bugs.php.net/fix.php?id=31125&r=needscript Try newer version: http://bugs.php.net/fix.php?id=31125&r=oldversion Not developer issue: http://bugs.php.net/fix.php?id=31125&r=support Expected behavior: http://bugs.php.net/fix.php?id=31125&r=notwrong Not enough info: http://bugs.php.net/fix.php?id=31125&r=notenoughinfo Submitted twice: http://bugs.php.net/fix.php?id=31125&r=submittedtwice register_globals: http://bugs.php.net/fix.php?id=31125&r=globals PHP 3 support discontinued: http://bugs.php.net/fix.php?id=31125&r=php3 Daylight Savings: http://bugs.php.net/fix.php?id=31125&r=dst IIS Stability: http://bugs.php.net/fix.php?id=31125&r=isapi Install GNU Sed: http://bugs.php.net/fix.php?id=31125&r=gnused Floating point limitations: http://bugs.php.net/fix.php?id=31125&r=float MySQL Configuration Error: http://bugs.php.net/fix.php?id=31125&r=mysqlcfg