bug52361.phpt 692 B

1234567891011121314151617181920212223242526272829303132333435
  1. --TEST--
  2. Bug #52361 (Throwing an exception in a destructor causes invalid catching)
  3. --FILE--
  4. <?php
  5. class aaa {
  6. public function __destruct() {
  7. try {
  8. throw new Exception(__CLASS__);
  9. } catch(Exception $ex) {
  10. echo "1. $ex\n";
  11. }
  12. }
  13. }
  14. function bbb() {
  15. $a = new aaa();
  16. throw new Exception(__FUNCTION__);
  17. }
  18. try {
  19. bbb();
  20. echo "must be skipped !!!";
  21. } catch(Exception $ex) {
  22. echo "2. $ex\n";
  23. }
  24. ?>
  25. --EXPECTF--
  26. 1. exception 'Exception' with message 'aaa' in %sbug52361.php:5
  27. Stack trace:
  28. #0 %sbug52361.php(16): aaa->__destruct()
  29. #1 %sbug52361.php(16): bbb()
  30. #2 {main}
  31. 2. exception 'Exception' with message 'bbb' in %sbug52361.php:13
  32. Stack trace:
  33. #0 %sbug52361.php(16): bbb()
  34. #1 {main}