summaryrefslogtreecommitdiff
path: root/Zend/tests/bug29368_3.phpt
diff options
context:
space:
mode:
authorDmitry Stogov <dmitry@zend.com>2019-04-12 00:49:45 +0300
committerDmitry Stogov <dmitry@zend.com>2019-04-12 00:49:45 +0300
commit88a2268d6b9ff152399a8761dc826ce414c0b985 (patch)
tree95fbbbf38882c3a394d1924a62623ce11c04859e /Zend/tests/bug29368_3.phpt
parentdb93c26e6d77e615957d47d6284ec49763d42113 (diff)
downloadphp-git-88a2268d6b9ff152399a8761dc826ce414c0b985.tar.gz
Replace "ZEND_CALL_CTOR" hack by additional live-range
Diffstat (limited to 'Zend/tests/bug29368_3.phpt')
-rw-r--r--Zend/tests/bug29368_3.phpt33
1 files changed, 33 insertions, 0 deletions
diff --git a/Zend/tests/bug29368_3.phpt b/Zend/tests/bug29368_3.phpt
new file mode 100644
index 0000000000..fafcc2a0ef
--- /dev/null
+++ b/Zend/tests/bug29368_3.phpt
@@ -0,0 +1,33 @@
+--TEST--
+Bug #29368.3 (The destructor is called when an exception is thrown from the constructor).
+--FILE--
+<?php
+class Foo {
+ function __construct() {
+ echo __METHOD__ . "\n";
+ }
+ function __destruct() {
+ echo __METHOD__ . "\n";
+ }
+}
+class Bar {
+ function __construct() {
+ echo __METHOD__ . "\n";
+ throw new Exception;
+ }
+ function __destruct() {
+ echo __METHOD__ . "\n";
+ }
+}
+
+try {
+ new Foo() + new Bar();
+} catch(Exception $exc) {
+ echo "Caught exception!\n";
+}
+?>
+--EXPECT--
+Foo::__construct
+Bar::__construct
+Foo::__destruct
+Caught exception!