xref: /PHP-7.3/Zend/tests/gc_035.phpt (revision 4f4a7f89)
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--EXPECT--
24int(0)
25int(2)
26int(0)
27