gc_030.phpt 676 B

123456789101112131415161718192021222324252627282930313233
  1. --TEST--
  2. GC 030: GC and exceptions in destructors
  3. --INI--
  4. zend.enable_gc=1
  5. --FILE--
  6. <?php
  7. class foo {
  8. public $foo;
  9. public function __destruct() {
  10. throw new Exception("foobar");
  11. }
  12. }
  13. $f1 = new foo;
  14. $f2 = new foo;
  15. $f1->foo = $f2;
  16. $f2->foo = $f1;
  17. unset($f1, $f2);
  18. gc_collect_cycles();
  19. ?>
  20. --EXPECTF--
  21. Fatal error: Uncaught exception 'Exception' with message 'foobar' in %sgc_030.php:%d
  22. Stack trace:
  23. #0 [internal function]: foo->__destruct()
  24. #1 %sgc_030.php(%d): gc_collect_cycles()
  25. #2 {main}
  26. Next exception 'Exception' with message 'foobar' in %sgc_030.php:%d
  27. Stack trace:
  28. #0 %sgc_030.php(%d): foo->__destruct()
  29. #1 {main}
  30. thrown in %sgc_030.php on line %d