#31114 [Asn->WFx]: foreach modify array (works with PHP 5.1)

From: Date: Fri, 11 Jul 2008 21:11:06 +0000
Subject: #31114 [Asn->WFx]: foreach modify array (works with PHP 5.1)
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-126518@lists.php.net to get a copy of this message
ID: 31114 Updated by: jani@php.net Reported By: clemens at gutweiler dot net -Status: Assigned +Status: Wont fix Bug Type: Arrays related Operating System: Linux 2.4.27 PHP Version: 4CVS Assigned To: andi New Comment: We are sorry, but we can not support PHP 4 related problems anymore. Momentum is gathering for PHP 6, and we think supporting PHP 4 will lead to a waste of resources which we want to put into getting PHP 6 ready. Previous Comments: ------------------------------------------------------------------------ [2007-08-07 11:35:50] fedotov dot leon at gmail dot com I stumbled across another werd behavior related to this bug: [php] $var = array( "a" => array("foo"), "b" => array("fox"), "c" => "x" ); foreach($var as $key => $val) { echo "no matter what happends".$val; } /* $var is array( "a" => array("foo"), "b" => array("fox"), "c" => "foo" ); */ [/php] ------------------------------------------------------------------------ [2005-05-17 12:01:49] sniper@php.net Works fine in PHP 5.. ------------------------------------------------------------------------ [2004-12-16 22:32:14] derick@php.net I just tested this on PHP 4.3.1 and 4.3.2 and it behaves in the same way, making this a non-critical bug and not related to the foreach speed-up patch. Assigning to Andi, as he might have a clue why this happens. The new foreach code is definitely not the problem here. ------------------------------------------------------------------------ [2004-12-16 13:07:17] derick@php.net (The only bug here is that it doesn't give a warning, using $k for both key and value is not supposed to work!) ------------------------------------------------------------------------ [2004-12-16 11:41:54] derick@php.net I don't think this was ever supposed to work. ------------------------------------------------------------------------ The remainder of the comments for this report are too long. To view the rest of the comments, please view the bug report online at http://bugs.php.net/31114 -- Edit this bug report at http://bugs.php.net/?id=31114&edit=1

« previous php.bugs (#126518) next »