ID: 32088 Updated by: [EMAIL PROTECTED] Reported By: karl at posmaster dot com dot au -Status: Open +Status: Feedback Bug Type: Zend Engine 2 problem Operating System: Slackware Linux 2.4.26 PHP Version: 5.0.3 New Comment:
Please try using this CVS snapshot: http://snaps.php.net/php5-STABLE-latest.tar.gz For Windows: http://snaps.php.net/win32/php5.0-win32-latest.zip I can't reproduce it. Previous Comments: ------------------------------------------------------------------------ [2005-02-23 23:30:05] karl at posmaster dot com dot au Description: ------------ Using "for each" I wanted to remove some items and change others. It seems that the reference in the loop no longer works once unset() has been called on the array. The commented line achieves the desired end, but circumvents the reference. The reference works if the unset() line is commented. This is reproduced without the use of Zend or 3rd part extensions. ----------------------- Reproduce code: --------------- <?php $stuff = array(array('one','two'),array('one','two'), array('three','four'),array('five','six'), array('seven','eight'),array('nine','ten')); var_dump($stuff); foreach ($stuff as $key => &$values) { print "on key:$key<br>"; if(($key%2)==0){ print "Running unset for $key <br>"; unset ($stuff[$key]); }else{ print "Running change for $key <br>"; $values[1]='foo'; // $stuff[$key][1] = 'foo'; } } var_dump($stuff); ?> Expected result: ---------------- I expected to see elements $stuff[1][1], $stuff[3][1] and $stuff[5][1] to be set to 'foo' Actual result: -------------- The elements are left unchanged. Are values 'two', 'six' and 'ten' respectively. ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=32088&edit=1
