]> granicus.if.org Git - php/commitdiff
- Add new test
authorMarcus Boerger <helly@php.net>
Sat, 2 Oct 2004 14:13:35 +0000 (14:13 +0000)
committerMarcus Boerger <helly@php.net>
Sat, 2 Oct 2004 14:13:35 +0000 (14:13 +0000)
Zend/tests/bug29368.phpt [new file with mode: 0755]

diff --git a/Zend/tests/bug29368.phpt b/Zend/tests/bug29368.phpt
new file mode 100755 (executable)
index 0000000..4c5a125
--- /dev/null
@@ -0,0 +1,34 @@
+--TEST--
+Bug #29368 (The destructor is called when an exception is thrown from the constructor)
+--FILE--
+<?
+
+class Foo
+{
+       function __construct()
+       {
+               echo __METHOD__ . "\n";
+               throw new Exception;
+       }
+       function __destruct()
+       {
+               echo __METHOD__ . "\n";
+       }
+}
+
+try
+{
+       $bar = new Foo;
+} catch(Exception $exc)
+{
+       echo "Caught exception!\n";
+}
+
+unset($bar);
+
+?>
+===DONE===
+--EXPECTF--
+Foo::__construct
+Caught exception!
+===DONE===