bug65784.phpt 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970
  1. --TEST--
  2. Fixed Bug #65784 (Segfault with finally)
  3. --FILE--
  4. <?php
  5. function foo1() {
  6. try {
  7. throw new Exception("not catch");
  8. return true;
  9. } finally {
  10. try {
  11. throw new Exception("caught");
  12. } catch (Exception $e) {
  13. }
  14. }
  15. }
  16. try {
  17. $foo = foo1();
  18. var_dump($foo);
  19. } catch (Exception $e) {
  20. do {
  21. var_dump($e->getMessage());
  22. } while ($e = $e->getPrevious());
  23. }
  24. function foo2() {
  25. try {
  26. try {
  27. throw new Exception("caught");
  28. return true;
  29. } finally {
  30. try {
  31. throw new Exception("caught");
  32. } catch (Exception $e) {
  33. }
  34. }
  35. } catch (Exception $e) {
  36. }
  37. }
  38. $foo = foo2();
  39. var_dump($foo);
  40. function foo3() {
  41. try {
  42. throw new Exception("not caught");
  43. return true;
  44. } finally {
  45. try {
  46. throw new NotExists();
  47. } catch (Exception $e) {
  48. }
  49. }
  50. }
  51. $bar = foo3();
  52. ?>
  53. --EXPECTF--
  54. string(9) "not catch"
  55. NULL
  56. Fatal error: Uncaught Exception: not caught in %sbug65784.php:42
  57. Stack trace:
  58. #0 %sbug65784.php(52): foo3()
  59. #1 {main}
  60. Next Error: Class "NotExists" not found in %s:%d
  61. Stack trace:
  62. #0 %sbug65784.php(52): foo3()
  63. #1 {main}
  64. thrown in %sbug65784.php on line 46