summaryrefslogtreecommitdiff
path: root/Zend/tests/try/try_finally_023.phpt
diff options
context:
space:
mode:
Diffstat (limited to 'Zend/tests/try/try_finally_023.phpt')
-rw-r--r--Zend/tests/try/try_finally_023.phpt37
1 files changed, 37 insertions, 0 deletions
diff --git a/Zend/tests/try/try_finally_023.phpt b/Zend/tests/try/try_finally_023.phpt
new file mode 100644
index 0000000000..e88eddb3b2
--- /dev/null
+++ b/Zend/tests/try/try_finally_023.phpt
@@ -0,0 +1,37 @@
+--TEST--
+Loop var dtor throwing exception during return inside try/catch inside finally
+--FILE--
+<?php
+
+class Dtor {
+ public function __destruct() {
+ throw new Exception(2);
+ }
+}
+
+function test() {
+ try {
+ throw new Exception(1);
+ } finally {
+ try {
+ foreach ([new Dtor] as $v) {
+ unset($v);
+ return 42;
+ }
+ } catch (Exception $e) {
+ }
+ }
+}
+
+try {
+ test();
+} catch (Exception $e) {
+ echo $e, "\n";
+}
+
+?>
+--EXPECTF--
+Exception: 1 in %s:%d
+Stack trace:
+#0 %s(%d): test()
+#1 {main}