summaryrefslogtreecommitdiff
path: root/tests/lang/035.phpt
diff options
context:
space:
mode:
authorMarcus Boerger <helly@php.net>2002-10-29 13:51:44 +0000
committerMarcus Boerger <helly@php.net>2002-10-29 13:51:44 +0000
commit0725405d74d239f83bf75c7384e977143b9e5848 (patch)
tree49c691c1296c39b367266e908836c645c0b7bcee /tests/lang/035.phpt
parentf168c6feef924cd20b2e1abd9bd79c4c59636dda (diff)
downloadphp-git-0725405d74d239f83bf75c7384e977143b9e5848.tar.gz
Rewrite: Taken from ZE2 RFC + a little textual modification
Diffstat (limited to 'tests/lang/035.phpt')
-rw-r--r--tests/lang/035.phpt35
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!'