try_finally_027.phpt 483 B

12345678910111213141516171819202122232425262728293031323334
  1. --TEST--
  2. Return in try with throw in finally, inside other finally
  3. --FILE--
  4. <?php
  5. function test() {
  6. try {
  7. throw new Exception(1);
  8. } finally {
  9. try {
  10. return 42;
  11. } finally {
  12. throw new Exception(2);
  13. }
  14. }
  15. }
  16. try {
  17. test();
  18. } catch (Exception $e) {
  19. echo $e, "\n";
  20. }
  21. ?>
  22. --EXPECTF--
  23. Exception: 1 in %s:%d
  24. Stack trace:
  25. #0 %s(%d): test()
  26. #1 {main}
  27. Next Exception: 2 in %s:%d
  28. Stack trace:
  29. #0 %s(%d): test()
  30. #1 {main}