summaryrefslogtreecommitdiff
path: root/Zend/tests/catch_004.phpt
diff options
context:
space:
mode:
Diffstat (limited to 'Zend/tests/catch_004.phpt')
-rwxr-xr-xZend/tests/catch_004.phpt43
1 files changed, 43 insertions, 0 deletions
diff --git a/Zend/tests/catch_004.phpt b/Zend/tests/catch_004.phpt
new file mode 100755
index 000000000..f1df06788
--- /dev/null
+++ b/Zend/tests/catch_004.phpt
@@ -0,0 +1,43 @@
+--TEST--
+Catching an exception in a constructor inside a static method
+--FILE--
+<?php
+
+class MyObject
+{
+ function fail()
+ {
+ throw new Exception();
+ }
+
+ function __construct()
+ {
+ self::fail();
+ echo __METHOD__ . "() Must not be reached\n";
+ }
+
+ function __destruct()
+ {
+ echo __METHOD__ . "() Must not be called\n";
+ }
+
+ static function test()
+ {
+ try
+ {
+ new MyObject();
+ }
+ catch(Exception $e)
+ {
+ echo "Caught\n";
+ }
+ }
+}
+
+MyObject::test();
+
+?>
+===DONE===
+--EXPECT--
+Caught
+===DONE===