summaryrefslogtreecommitdiff
path: root/Zend/tests/bug72543.phpt
blob: a826b1d6fb362c16b43b727f1431f202450a8f4f (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
--TEST--
Bug #72543 (different references behavior comparing to PHP 5)
--FILE--
<?php
function create_references(&$array) {
    foreach ($array as $key => $value) {
        create_references($array[$key]);
    }
}

function change_copy($copy) {
        $copy['b']['z']['z'] = $copy['b'];
}

$data = [
    'a' => [
        'b' => [],
    ], 
];

create_references($data);

$copy = $data['a'];
var_dump($copy);

change_copy($copy);
var_dump($copy); //RECURSION
?>
--EXPECT--
array(1) {
  ["b"]=>
  array(0) {
  }
}
array(1) {
  ["b"]=>
  array(0) {
  }
}