catch_novar_2.phpt 571 B

1234567891011121314151617181920212223242526
  1. --TEST--
  2. catch without capturing a variable - exception in destructor
  3. --FILE--
  4. <?php
  5. class ThrowsOnDestruct extends Exception {
  6. public function __destruct() {
  7. echo "Throwing\n";
  8. throw new RuntimeException(__METHOD__);
  9. }
  10. }
  11. try {
  12. throw new ThrowsOnDestruct();
  13. } catch (Exception) {
  14. echo "Unreachable catch\n";
  15. }
  16. echo "Unreachable fallthrough\n";
  17. ?>
  18. --EXPECTF--
  19. Throwing
  20. Fatal error: Uncaught RuntimeException: ThrowsOnDestruct::__destruct in %s:%d
  21. Stack trace:
  22. #0 %s(%d): ThrowsOnDestruct->__destruct()
  23. #1 {main}
  24. thrown in %s on line %d