gc_011.phpt 350 B

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