summaryrefslogtreecommitdiff
path: root/Zend/zend_opcode.c
diff options
context:
space:
mode:
authorDmitry Stogov <dmitry@zend.com>2016-05-25 01:25:12 +0300
committerDmitry Stogov <dmitry@zend.com>2016-05-25 01:25:12 +0300
commit2ae21abdf7b87ee95d76aca22e787408d7c766cf (patch)
tree26c8c6ba8f81f077c10cd5031b3d8b79ecdaa064 /Zend/zend_opcode.c
parent91f5940329fede8a26b64e99d4d6d858fe8654cc (diff)
downloadphp-git-2ae21abdf7b87ee95d76aca22e787408d7c766cf.tar.gz
Fixed bug #72213 (Finally leaks on nested exceptions).
Squashed commit of the following: commit 8461b0407fc9eab0869d43b84e6a92ba2fe06997 Author: Dmitry Stogov <dmitry@zend.com> Date: Wed May 25 00:34:42 2016 +0300 Rmoved zend_try_catch_element.parent and walk through op_array.try_catch_array backward from the current try_cacth_offset. commit 0c71e249649bed178bfbef30bb3e63c57f07af05 Author: Dmitry Stogov <dmitry@zend.com> Date: Wed May 25 00:04:53 2016 +0300 Move SAVE_OPLINE() to its original place commit 111432a4df738fcd65878a42f23194dc3c4983a2 Author: Dmitry Stogov <dmitry@zend.com> Date: Wed May 25 00:01:10 2016 +0300 Separate the common part of ZEND_HANDLE_EXCEPTION and FAST_RET into zend_dispatch_try_catch_finally_helper. commit 4f21c06c2ec17819a708bc037f318784554a6ecd Author: Nikita Popov <nikic@php.net> Date: Tue May 24 14:55:27 2016 +0200 Improve finally fix commit da5c7274997b8308e682b5bf280124e3a1483086 Author: Dmitry Stogov <dmitry@zend.com> Date: Tue May 24 10:36:08 2016 +0300 Fixed Zend/tests/try/bug70228_3.phpt and Zend/tests/try/bug70228_4.phpt commit cfcedf2fb4f4fc1f7de9f7d53a3037fed7795f19 Author: Dmitry Stogov <dmitry@zend.com> Date: Tue May 24 02:59:27 2016 +0300 Added test commit 4c6aa93d43da941eb4fda15b48154bfb104bdc04 Author: Dmitry Stogov <dmitry@zend.com> Date: Tue May 24 00:38:20 2016 +0300 Added tests commit 8a8f4704b0eca2e460d42c1f253a363b0db8e510 Author: Dmitry Stogov <dmitry@zend.com> Date: Mon May 23 23:27:34 2016 +0300 Fixed bug #72213 (Finally leaks on nested exceptions)
Diffstat (limited to 'Zend/zend_opcode.c')
-rw-r--r--Zend/zend_opcode.c55
1 files changed, 0 insertions, 55 deletions
diff --git a/Zend/zend_opcode.c b/Zend/zend_opcode.c
index 34e060fa4a..0b5fe75ff8 100644
--- a/Zend/zend_opcode.c
+++ b/Zend/zend_opcode.c
@@ -534,57 +534,6 @@ static void zend_check_finally_breakout(zend_op_array *op_array, uint32_t op_num
}
}
-static void zend_resolve_fast_call(zend_op_array *op_array, uint32_t op_num)
-{
- int i;
- uint32_t finally_num = (uint32_t)-1;
-
- for (i = 0; i < op_array->last_try_catch; i++) {
- if (op_num >= op_array->try_catch_array[i].finally_op
- && op_num < op_array->try_catch_array[i].finally_end) {
- finally_num = i;
- }
- }
-
- if (finally_num != (uint32_t)-1) {
- /* Must be ZEND_FAST_CALL */
- ZEND_ASSERT(op_array->opcodes[op_array->try_catch_array[finally_num].finally_op - 2].opcode == ZEND_FAST_CALL);
- op_array->opcodes[op_num].extended_value = ZEND_FAST_CALL_FROM_FINALLY;
- }
-}
-
-static void zend_resolve_finally_ret(zend_op_array *op_array, uint32_t op_num)
-{
- int i;
- uint32_t finally_num = (uint32_t)-1;
- uint32_t catch_num = (uint32_t)-1;
-
- for (i = 0; i < op_array->last_try_catch; i++) {
- if (op_array->try_catch_array[i].try_op > op_num) {
- break;
- }
- if (op_num < op_array->try_catch_array[i].finally_op) {
- finally_num = i;
- }
- if (op_num < op_array->try_catch_array[i].catch_op) {
- catch_num = i;
- }
- }
-
- if (finally_num != (uint32_t)-1 &&
- (catch_num == (uint32_t)-1 ||
- op_array->try_catch_array[catch_num].catch_op >=
- op_array->try_catch_array[finally_num].finally_op)) {
- /* in case of unhandled exception return to upward finally block */
- op_array->opcodes[op_num].extended_value = ZEND_FAST_RET_TO_FINALLY;
- op_array->opcodes[op_num].op2.num = finally_num;
- } else if (catch_num != (uint32_t)-1) {
- /* in case of unhandled exception return to upward catch block */
- op_array->opcodes[op_num].extended_value = ZEND_FAST_RET_TO_CATCH;
- op_array->opcodes[op_num].op2.num = catch_num;
- }
-}
-
static uint32_t zend_get_brk_cont_target(const zend_op_array *op_array, const zend_op *opline) {
int nest_levels = opline->op2.num;
int array_offset = opline->op1.num;
@@ -633,12 +582,8 @@ ZEND_API int pass_two(zend_op_array *op_array)
switch (opline->opcode) {
case ZEND_FAST_CALL:
opline->op1.opline_num = op_array->try_catch_array[opline->op1.num].finally_op;
- zend_resolve_fast_call(op_array, opline - op_array->opcodes);
ZEND_PASS_TWO_UPDATE_JMP_TARGET(op_array, opline, opline->op1);
break;
- case ZEND_FAST_RET:
- zend_resolve_finally_ret(op_array, opline - op_array->opcodes);
- break;
case ZEND_BRK:
case ZEND_CONT:
{