summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorXinchen Hui <laruence@php.net>2015-07-08 17:14:19 +0800
committerXinchen Hui <laruence@php.net>2015-07-08 17:14:19 +0800
commitca30d5bf3947922a618d95f1ae16886204f37292 (patch)
tree3440e1edfdefa118c6d823d533811a7e03cfcfc4
parente68b5252a2b518c6f9b49f6eeae266b3e450573e (diff)
downloadphp-git-ca30d5bf3947922a618d95f1ae16886204f37292.tar.gz
Fixed bug #70012 (Exception lost with nested finally block)
-rw-r--r--NEWS3
-rw-r--r--Zend/tests/bug70012.phpt32
-rw-r--r--Zend/zend_vm_def.h7
-rw-r--r--Zend/zend_vm_execute.h7
4 files changed, 45 insertions, 4 deletions
diff --git a/NEWS b/NEWS
index a8cf659c05..d4a4561150 100644
--- a/NEWS
+++ b/NEWS
@@ -2,6 +2,9 @@ PHP NEWS
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
?? Jul 2015, PHP 5.6.12
+- Core:
+ . Fixed bug #70012 (Exception lost with nested finally block). (Laruence)
+
- CLI server:
. Fixed bug #69655 (php -S changes MKCALENDAR request method to MKCOL). (cmb)
. Fixed bug #64878 (304 responses return Content-Type header). (cmb)
diff --git a/Zend/tests/bug70012.phpt b/Zend/tests/bug70012.phpt
new file mode 100644
index 0000000000..5337649d2d
--- /dev/null
+++ b/Zend/tests/bug70012.phpt
@@ -0,0 +1,32 @@
+--TEST--
+Bug #70012 (Exception lost with nested finally block)
+--FILE--
+<?php
+try {
+ echo "Outer try\n";
+ try {
+ echo " Middle try\n";
+ throw new Exception();
+ } finally {
+ echo " Middle finally\n";
+ try {
+ echo " Inner try\n";
+ } finally {
+ echo " Inner finally\n";
+ }
+ }
+ echo "Outer shouldnt get here\n";
+} catch (Exception $e) {
+ echo "Outer catch\n";
+} finally {
+ echo "Outer finally\n";
+}
+?>
+--EXPECT--
+Outer try
+ Middle try
+ Middle finally
+ Inner try
+ Inner finally
+Outer catch
+Outer finally
diff --git a/Zend/zend_vm_def.h b/Zend/zend_vm_def.h
index c7b2d2a934..11f62053b1 100644
--- a/Zend/zend_vm_def.h
+++ b/Zend/zend_vm_def.h
@@ -5650,8 +5650,11 @@ ZEND_VM_HANDLER(162, ZEND_FAST_CALL, ANY, ANY)
ZEND_VM_SET_OPCODE(&EX(op_array)->opcodes[opline->op2.opline_num]);
ZEND_VM_CONTINUE();
}
- EX(fast_ret) = opline;
- EX(delayed_exception) = NULL;
+ if (UNEXPECTED(EX(delayed_exception) != NULL)) {
+ EX(fast_ret) = NULL;
+ } else {
+ EX(fast_ret) = opline;
+ }
ZEND_VM_SET_OPCODE(opline->op1.jmp_addr);
ZEND_VM_CONTINUE();
}
diff --git a/Zend/zend_vm_execute.h b/Zend/zend_vm_execute.h
index 0de6b4ab57..5ed4135c59 100644
--- a/Zend/zend_vm_execute.h
+++ b/Zend/zend_vm_execute.h
@@ -1354,8 +1354,11 @@ static int ZEND_FASTCALL ZEND_FAST_CALL_SPEC_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
ZEND_VM_SET_OPCODE(&EX(op_array)->opcodes[opline->op2.opline_num]);
ZEND_VM_CONTINUE();
}
- EX(fast_ret) = opline;
- EX(delayed_exception) = NULL;
+ if (UNEXPECTED(EX(delayed_exception) != NULL)) {
+ EX(fast_ret) = NULL;
+ } else {
+ EX(fast_ret) = opline;
+ }
ZEND_VM_SET_OPCODE(opline->op1.jmp_addr);
ZEND_VM_CONTINUE();
}