035.phpt 742 B

1234567891011121314151617181920212223242526272829303132333435363738
  1. --TEST--
  2. ZE2: set_exception_handler()
  3. --SKIPIF--
  4. <?php if (version_compare(zend_version(), "2.0.0-dev", "<")) print "skip Zend engine 2 required"; ?>
  5. --FILE--
  6. <?php
  7. class MyException extends Exception {
  8. function MyException($_error) {
  9. $this->error = $_error;
  10. }
  11. function getException()
  12. {
  13. return $this->error;
  14. }
  15. }
  16. function ThrowException()
  17. {
  18. throw new MyException("'This is an exception!'");
  19. }
  20. try {
  21. } catch (MyException $exception) {
  22. print "There shouldn't be an exception: " . $exception->getException();
  23. print "\n";
  24. }
  25. try {
  26. ThrowException();
  27. } catch (MyException $exception) {
  28. print "There was an exception: " . $exception->getException();
  29. print "\n";
  30. }
  31. ?>
  32. --EXPECT--
  33. There was an exception: 'This is an exception!'