xref: /PHP-8.1/Zend/tests/gc_016.phpt (revision b58d7454)
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());
21echo "ok\n"
22?>
23--EXPECT--
24-> int(0)
25int(2)
26ok
27