xref: /PHP-8.3/Zend/tests/gc_011.phpt (revision b58d7454)
1--TEST--
2GC 011: GC and destructors
3--INI--
4zend.enable_gc=1
5--FILE--
6<?php
7class Foo {
8    public $a;
9    function __destruct() {
10        echo __FUNCTION__,"\n";
11    }
12}
13$a = new Foo();
14$a->a = $a;
15var_dump($a);
16unset($a);
17var_dump(gc_collect_cycles());
18echo "ok\n"
19?>
20--EXPECTF--
21object(Foo)#%d (1) {
22  ["a"]=>
23  *RECURSION*
24}
25__destruct
26int(1)
27ok
28