xref: /PHP-7.1/Zend/tests/bug72543.phpt (revision 7af945e2)
1--TEST--
2Bug #72543 (different references behavior comparing to PHP 5)
3--FILE--
4<?php
5function create_references(&$array) {
6    foreach ($array as $key => $value) {
7        create_references($array[$key]);
8    }
9}
10
11function change_copy($copy) {
12        $copy['b']['z']['z'] = $copy['b'];
13}
14
15$data = [
16    'a' => [
17        'b' => [],
18    ],
19];
20
21create_references($data);
22
23$copy = $data['a'];
24var_dump($copy);
25
26change_copy($copy);
27var_dump($copy); //RECURSION
28?>
29--EXPECT--
30array(1) {
31  ["b"]=>
32  array(0) {
33  }
34}
35array(1) {
36  ["b"]=>
37  array(0) {
38  }
39}
40