exceptions_001.phpt 844 B

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. --TEST--
  2. Properly handle exceptions going to be uncaught
  3. --PHPDBG--
  4. r
  5. t
  6. ev 1 + 2
  7. c
  8. q
  9. --EXPECTF--
  10. [Successful compilation of %s]
  11. prompt> handle first
  12. [Uncaught Error in %s on line 16: Call to undefined function foo()]
  13. >00016: foo(); // Error
  14. 00017: } catch (\Exception $e) {
  15. 00018: var_dump($e);
  16. prompt> frame #0: {closure}() at %s:16
  17. frame #1: {main} at %s:22
  18. prompt> 3
  19. prompt> [Uncaught Error in %s on line 16]
  20. Error: Call to undefined function foo() in %s:16
  21. Stack trace:
  22. #0 %s(22): {closure}()
  23. #1 {main}
  24. [Script ended normally]
  25. prompt>
  26. --FILE--
  27. <?php
  28. (function() {
  29. try {
  30. foo(); // Error
  31. } catch (\Exception $e) {
  32. var_dump($e);
  33. } finally {
  34. print "handle first\n";
  35. return "ok";
  36. }
  37. })();
  38. (function() {
  39. try {
  40. foo(); // Error
  41. } catch (\Exception $e) {
  42. var_dump($e);
  43. } catch (\ParseError $e) {
  44. var_dump($e);
  45. }
  46. })();