blob: aafceb09ad19de9cb60d420897ab7d170b06e162 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
|
--TEST--
Bug #71969 (str_replace returns an incorrect resulting array after a foreach by reference)
--FILE--
<?php
$a = array(
array("one" => array("a"=>"0000", "b"=>"1111")),
);
//foreach by reference, changing the array value
foreach($a as &$record)
{
$record["one"]["a"] = "2222";
}
var_dump(str_replace("2", "3", $a));
?>
--EXPECT--
array(1) {
[0]=>
array(1) {
["one"]=>
array(2) {
["a"]=>
string(4) "2222"
["b"]=>
string(4) "1111"
}
}
}
|