blob: 7499667aaf6ddd94a8e07ef37120c9ac521b8883 (
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
39
40
|
--TEST--
Bug #34982 (array_walk_recursive() modifies elements outside function scope)
--FILE--
<?php
$ar = array(
'element 1',
array('subelement1')
);
func($ar);
print_r($ar);
function func($a) {
array_walk_recursive($a, 'apply');
print_r($a);
}
function apply(&$input, $key) {
$input = 'changed';
}
?>
--EXPECT--
Array
(
[0] => changed
[1] => Array
(
[0] => changed
)
)
Array
(
[0] => element 1
[1] => Array
(
[0] => subelement1
)
)
|