xref: /PHP-7.4/Zend/tests/bug35163_2.phpt (revision 610c7fbe)
1--TEST--
2Bug #35163.2 (Array elements can lose references)
3--FILE--
4<?php
5$a = array(1);
6$b = 'a';
7${$b}[] =& $$b;
8${$b}[] =& $$b;
9${$b}[0] = 2;
10var_dump($a);
11$a[0] = null;
12$a = null;
13?>
14--EXPECT--
15array(3) {
16  [0]=>
17  int(2)
18  [1]=>
19  &array(3) {
20    [0]=>
21    int(2)
22    [1]=>
23    *RECURSION*
24    [2]=>
25    *RECURSION*
26  }
27  [2]=>
28  &array(3) {
29    [0]=>
30    int(2)
31    [1]=>
32    *RECURSION*
33    [2]=>
34    *RECURSION*
35  }
36}
37