bug29368_2.phpt 381 B

123456789101112131415161718192021
  1. --TEST--
  2. Bug #29368.2 (The destructor is called when an exception is thrown from the constructor).
  3. --FILE--
  4. <?php
  5. class Bomb {
  6. function foo() {
  7. }
  8. function __destruct() {
  9. throw new Exception("bomb!");
  10. }
  11. }
  12. try {
  13. $x = new ReflectionMethod(new Bomb(), "foo");
  14. } catch (Throwable $e) {
  15. echo $e->getMessage() . "\n";
  16. }
  17. echo "ok\n";
  18. ?>
  19. --EXPECT--
  20. bomb!
  21. ok