bug77882.phpt 623 B

1234567891011121314151617181920212223242526272829303132333435363738
  1. --TEST--
  2. Bug #77882: Different behavior: always calls destructor
  3. --FILE--
  4. <?php
  5. class Test {
  6. public function __construct() {
  7. throw new Exception();
  8. }
  9. public function __destruct() {
  10. echo "__destruct\n";
  11. }
  12. }
  13. try {
  14. new Test();
  15. } catch (Exception $e) {
  16. echo "Exception\n";
  17. }
  18. try {
  19. $ref = new ReflectionClass('Test');
  20. $obj = $ref->newInstance();
  21. } catch (Exception $e) {
  22. echo "Exception\n";
  23. }
  24. try {
  25. $ref = new ReflectionClass('Test');
  26. $obj = $ref->newInstanceArgs([]);
  27. } catch (Exception $e) {
  28. echo "Exception\n";
  29. }
  30. ?>
  31. --EXPECT--
  32. Exception
  33. Exception
  34. Exception