xref: /PHP-8.0/Zend/tests/gc_016.phpt (revision f8d79582)
1--TEST--
2GC 016: nested GC calls
3--INI--
4zend.enable_gc=1
5--FILE--
6<?php
7class Foo {
8    public $a;
9    function __destruct() {
10        echo "-> ";
11        $a = array();
12        $a[] =& $a;
13        unset($a);
14        var_dump(gc_collect_cycles());
15    }
16}
17$a = new Foo();
18$a->a = $a;
19unset($a);
20var_dump(gc_collect_cycles());
21var_dump(gc_collect_cycles());
22echo "ok\n"
23?>
24--EXPECT--
25-> int(0)
26int(0)
27int(2)
28ok
29