xref: /PHP-7.2/Zend/tests/gc_041.phpt (revision 9b43e29d)
1--TEST--
2GC 041: Handling of references in nested data of objects with destructor
3--INI--
4zend.enable_gc = 1
5--FILE--
6<?php
7class ryat {
8	    var $ryat;
9        var $chtg;
10        var $nested;
11	    function __destruct() {
12	            $GLOBALS['x'] = $this;
13        }
14}
15$o = new ryat;
16$o->nested = [];
17$o->nested[] =& $o->nested;
18$o->ryat = $o;
19$x =& $o->chtg;
20unset($o);
21gc_collect_cycles();
22var_dump($x);
23?>
24--EXPECT--
25object(ryat)#1 (3) {
26  ["ryat"]=>
27  *RECURSION*
28  ["chtg"]=>
29  *RECURSION*
30  ["nested"]=>
31  &array(1) {
32    [0]=>
33    *RECURSION*
34  }
35}