com php-src: Fixed bug #70012 (Exception lost with nested finally block): NEWS Zend/tests/bug70012.phpt Zend/zend_vm_def.h Zend/z end_vm_execute.h
| From: | Xinchen Hui | Date: | Wed, 08 Jul 2015 09:14:19 +0000 |
| Subject: | com php-src: Fixed bug #70012 (Exception lost with nested finally block): NEWS Zend/tests/bug70012.phpt Zend/zend_vm_def.h Zend/z end_vm_execute.h | ||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-87840@lists.php.net to get a copy of this message | ||
Commit: ca30d5bf3947922a618d95f1ae16886204f37292
Author: Xinchen Hui <laruence@php.net> Wed, 8 Jul 2015 17:14:19 +0800
Parents: e68b5252a2b518c6f9b49f6eeae266b3e450573e
Branches: PHP-5.6 master
Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=ca30d5bf3947922a618d95f1ae16886204f37292
Log:
Fixed bug #70012 (Exception lost with nested finally block)
Bugs:
https://bugs.php.net/70012
Changed paths:
M NEWS
A Zend/tests/bug70012.phpt
M Zend/zend_vm_def.h
M Zend/zend_vm_execute.h
Diff:
diff --git a/NEWS b/NEWS
index a8cf659..d4a4561 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 0000000..5337649
--- /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 c7b2d2a..11f6205 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 0de6b4a..5ed4135 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();
}