xref: /PHP-8.0/Zend/tests/gc_035.phpt (revision 7aacc705)
1--TEST--
2GC 035: Lost inner-cycles garbage
3--INI--
4zend.enable_gc = 1
5--FILE--
6<?php
7class A {
8    public $a;
9    public $x;
10    function __destruct() {
11        unset($this->x);
12    }
13}
14$a = new A;
15$a->a = $a;
16$a->x = [];
17$a->x[] =& $a->x;
18$a->x[] = $a;
19var_dump(gc_collect_cycles());
20unset($a);
21var_dump(gc_collect_cycles());
22var_dump(gc_collect_cycles());
23?>
24--EXPECT--
25int(0)
26int(0)
27int(2)
28