blob: ac8be2ba2fc6f4f1f635a4ec8eec5638b5448ab2 (
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
29
30
31
32
33
34
35
36
37
38
|
--TEST--
array_merge/replace_recursive() should unwrap references with rc=1
--FILE--
<?php
$x = 24;
$arr1 = [[42]];
$arr2 = [[&$x]];
unset($x);
$arr3 = array_replace_recursive($arr1, $arr2);
$arr2[0][0] = 12;
var_dump($arr3);
unset($arr1, $arr2, $arr3);
$x = 24;
$arr1 = [42];
$arr2 = [&$x];
unset($x);
$arr3 = array_merge_recursive($arr1, $arr2);
$arr2[0] = 12;
var_dump($arr3);
?>
--EXPECT--
array(1) {
[0]=>
array(1) {
[0]=>
int(24)
}
}
array(2) {
[0]=>
int(42)
[1]=>
int(24)
}
|