diff options
-rw-r--r-- | tests/lang/035.phpt | 35 |
1 files changed, 26 insertions, 9 deletions
diff --git a/tests/lang/035.phpt b/tests/lang/035.phpt index 5f22d52cae..c6970b7bdf 100644 --- a/tests/lang/035.phpt +++ b/tests/lang/035.phpt @@ -1,21 +1,38 @@ --TEST-- ZE2: set_exception_handler() --SKIPIF-- -<?php if (version_compare(zend_version(), "2", "<")) print "skip"; ?> +<?php if (version_compare(zend_version(), "2.0.0-dev", "<")) print "skip Zend engine 2 required"; ?> --FILE-- <?php +class MyException { + function MyException($_error) { + $this->error = $_error; + } + + function getException() + { + return $this->error; + } +} -set_exception_handler("my_handler"); -try { - throw new exception(); -} catch (stdClass $e) { - print "BAR\n"; +function ThrowException() +{ + throw new MyException("'This is an exception!'"); } -function my_handler($exception) { - print "FOO\n"; + +try { +} catch (MyException $exception) { + print "There shouldn't be an exception: " . $exception->getException(); + print "\n"; } +try { + ThrowException(); +} catch (MyException $exception) { + print "There was an exception: " . $exception->getException(); + print "\n"; +} ?> --EXPECT-- -FOO +There was an exception: 'This is an exception!' |