gc_030.phpt 668 B

12345678910111213141516171819202122232425262728293031323334
  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: 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: foobar in %sgc_030.php:%d
  27. Stack trace:
  28. #0 [internal function]: foo->__destruct()
  29. #1 %sgc_030.php(%d): gc_collect_cycles()
  30. #2 {main}
  31. thrown in %sgc_030.php on line %d