#42655 [Opn->Bgs]: array_walk_recursive() leaves references
| From: | tony2001@php.net | Date: | Tue, 02 Oct 2007 12:08:33 +0000 |
| Subject: | #42655 [Opn->Bgs]: array_walk_recursive() leaves references | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-118088@lists.php.net to get a copy of this message | ||
ID: 42655
Updated by: tony2001@php.net
Reported By: ltaupiac at lfdj dot com
-Status: Open
+Status: Bogus
Bug Type: Arrays related
Operating System: *
PHP Version: 5CVS-2007-09-13 (snap)
New Comment:
See bug #34982.
Previous Comments:
------------------------------------------------------------------------
[2007-09-13 11:08:37] ltaupiac at lfdj dot com
Description:
------------
Using array_walk_recursive leaves references on source array.
Reproduce code:
---------------
$data = array ('key1' => 'val1', array('key2' =>
'val2'), 'key3'
=>'val3');
function foo($item, $key){}
var_dump($data);
array_walk_recursive($data,'foo');
var_dump($data);
Expected result:
----------------
array(3) {
["key1"]=>
string(4) "val1"
[0]=>
array(1) {
["key2"]=>
string(4) "val2"
}
["key3"]=>
string(4) "val3"
}
array(3) {
["key1"]=>
string(4) "val1"
[0]=>
array(1) {
["key2"]=>
string(4) "val2"
}
["key3"]=>
string(4) "val3"
}
Actual result:
--------------
array(3) {
["key1"]=>
string(4) "val1"
[0]=>
array(1) {
["key2"]=>
string(4) "val2"
}
["key3"]=>
string(4) "val3"
}
array(3) {
["key1"]=>
string(4) "val1"
[0]=>
&array(1) {
["key2"]=>
string(4) "val2"
}
["key3"]=>
string(4) "val3"
}
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=42655&edit=1