]> granicus.if.org Git - php/commitdiff
Rewrite: Taken from ZE2 RFC + a little textual modification
authorMarcus Boerger <helly@php.net>
Tue, 29 Oct 2002 13:51:44 +0000 (13:51 +0000)
committerMarcus Boerger <helly@php.net>
Tue, 29 Oct 2002 13:51:44 +0000 (13:51 +0000)
tests/lang/035.phpt

index 5f22d52cae38012e9e2f8d3cf3b1d7898c8cbde7..c6970b7bdf3ff806ff345fbcd5e390f99b31f448 100644 (file)
@@ -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!'