summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorMarcus Boerger <helly@php.net>2004-07-25 19:21:21 +0000
committerMarcus Boerger <helly@php.net>2004-07-25 19:21:21 +0000
commit03c19c2b8f5ad72ac3b3564f25b883be73f8a7b6 (patch)
tree7928f0c5c382bfdd6a5b62e96ea43f1058c32588 /tests
parentfd83c1ea411990551356b87e3c3e6657fd10b4f5 (diff)
downloadphp-git-03c19c2b8f5ad72ac3b3564f25b883be73f8a7b6.tar.gz
- Add new test
Diffstat (limited to 'tests')
-rwxr-xr-xtests/classes/ctor_failure.phpt33
1 files changed, 33 insertions, 0 deletions
diff --git a/tests/classes/ctor_failure.phpt b/tests/classes/ctor_failure.phpt
new file mode 100755
index 0000000000..bbebca2af8
--- /dev/null
+++ b/tests/classes/ctor_failure.phpt
@@ -0,0 +1,33 @@
+--TEST--
+Do not call destructors if constructor fails
+--FILE--
+<?php
+
+class Test
+{
+ function __construct($msg) {
+ echo __METHOD__ . "($msg)\n";
+ throw new Exception($msg);
+ }
+
+ function __destruct() {
+ echo __METHOD__ . "\n";
+ }
+}
+
+try
+{
+ $o = new Test('Hello');
+ unset($o);
+}
+catch (Exception $e)
+{
+ echo 'Caught ' . get_class($e) . '(' . $e->getMessage() . ")\n";
+}
+
+?>
+===DONE===
+--EXPECT--
+Test::__construct(Hello)
+Caught Exception(Hello)
+===DONE===