ID: 25671 Updated by: [EMAIL PROTECTED] Reported By: ivan dot lamouret at caramail dot com -Status: Open +Status: Closed Bug Type: Unknown/Other Function Operating System: cobalt linux 6.4 PHP Version: 4.3.2 New Comment:
This bug has been fixed in CVS. In case this was a PHP problem, snapshots of the sources are packaged every three hours; this change will be in the next snapshot. You can grab the snapshot at http://snaps.php.net/. In case this was a documentation problem, the fix will show up soon at http://www.php.net/manual/. In case this was a PHP.net website problem, the change will show up on the PHP.net site and on the mirror sites in short time. Thank you for the report, and for helping us make PHP better. Previous Comments: ------------------------------------------------------------------------ [2003-09-26 11:51:37] ivan dot lamouret at caramail dot com Description: ------------ after calling str_replace on a nested array the resulting array changes values unexpectedly. Note that in the code below, there is no reference in the array values. while trying different versions the code (reducing the size from my original code), the value of $fixed["firstlevel"] came also as : &NULL &UNKNOWN:0 bar tostr ... that may be related to Bug #23654? regards, Ivan Reproduce code: --------------- function foo ($someuselessvar,$str){ $local=str_replace("fromstr","tostr",$str); } //----------------------------------------------/ function bar($var){ $result=array(); $result["firstlevel"]["secondlevel"]="$var";//unquote will change behavior! foo("someuselessstring", $result); return $result; } $first="foooo"; //$first="foooooooo"; $fixed=bar("$first"); //unquote will change behavior! var_dump($fixed); $tmp=bar("foo"); var_dump($fixed); $tmp=bar("foooo"); var_dump($fixed); $tmp=bar("foooooooo"); var_dump($fixed); $tmp=bar("fooo"); var_dump($fixed); Expected result: ---------------- Five times the same first dump!: array(1) { ["firstlevel"]=> array(1) { ["secondlevel"]=> string(5) "foooo" } } Actual result: -------------- array(1) { ["firstlevel"]=> array(1) { ["secondlevel"]=> string(5) "foooo" } } array(1) { ["firstlevel"]=> string(3) "foo" } array(1) { ["firstlevel"]=> string(17) "someuselessstring" } array(1) { ["firstlevel"]=> array(1) { ["firstlevel"]=> array(1) { ["secondlevel"]=> string(9) "foooooooo" } } } array(1) { ["firstlevel"]=> NULL } ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=25671&edit=1
