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()); 18var_dump(gc_collect_cycles()); 19echo "ok\n" 20?> 21--EXPECTF-- 22object(Foo)#%d (1) { 23 ["a"]=> 24 *RECURSION* 25} 26__destruct 27int(0) 28int(1) 29ok 30