exception_004.phpt 344 B

12345678910111213141516171819
  1. --TEST--
  2. Throwing exception using a class that isn't derived from the Exception base class
  3. --FILE--
  4. <?php
  5. class Foo { }
  6. try {
  7. throw new Foo();
  8. } catch (Foo $e) {
  9. var_dump($e);
  10. }
  11. ?>
  12. --EXPECTF--
  13. Fatal error: Uncaught Error: Cannot throw objects that do not implement Throwable in %s:%d
  14. Stack trace:
  15. #0 {main}
  16. thrown in %s on line %d