From: ltaupiac at lfdj dot com
Operating system: Window | solaris
PHP version: 5CVS-2007-09-13 (snap)
PHP Bug Type: Arrays related
Bug description: array_walk_recursive leaves references
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 bug report at http://bugs.php.net/?id=42655&edit=1
--
Try a CVS snapshot (PHP 4.4):
http://bugs.php.net/fix.php?id=42655&r=trysnapshot44
Try a CVS snapshot (PHP 5.2):
http://bugs.php.net/fix.php?id=42655&r=trysnapshot52
Try a CVS snapshot (PHP 6.0):
http://bugs.php.net/fix.php?id=42655&r=trysnapshot60
Fixed in CVS: http://bugs.php.net/fix.php?id=42655&r=fixedcvs
Fixed in release:
http://bugs.php.net/fix.php?id=42655&r=alreadyfixed
Need backtrace: http://bugs.php.net/fix.php?id=42655&r=needtrace
Need Reproduce Script: http://bugs.php.net/fix.php?id=42655&r=needscript
Try newer version: http://bugs.php.net/fix.php?id=42655&r=oldversion
Not developer issue: http://bugs.php.net/fix.php?id=42655&r=support
Expected behavior: http://bugs.php.net/fix.php?id=42655&r=notwrong
Not enough info:
http://bugs.php.net/fix.php?id=42655&r=notenoughinfo
Submitted twice:
http://bugs.php.net/fix.php?id=42655&r=submittedtwice
register_globals: http://bugs.php.net/fix.php?id=42655&r=globals
PHP 3 support discontinued: http://bugs.php.net/fix.php?id=42655&r=php3
Daylight Savings: http://bugs.php.net/fix.php?id=42655&r=dst
IIS Stability: http://bugs.php.net/fix.php?id=42655&r=isapi
Install GNU Sed: http://bugs.php.net/fix.php?id=42655&r=gnused
Floating point limitations: http://bugs.php.net/fix.php?id=42655&r=float
No Zend Extensions: http://bugs.php.net/fix.php?id=42655&r=nozend
MySQL Configuration Error: http://bugs.php.net/fix.php?id=42655&r=mysqlcfg