summaryrefslogtreecommitdiff
path: root/Zend/zend_vm_execute.h
diff options
context:
space:
mode:
authorDmitry Stogov <dmitry@zend.com>2015-11-10 10:11:46 +0300
committerDmitry Stogov <dmitry@zend.com>2015-11-10 10:11:46 +0300
commit6fe457f3234c7124b5138295870c1e76c3858074 (patch)
tree9c1d4b3450a31b2aaea7590e944c653900e3760f /Zend/zend_vm_execute.h
parent7bc6361294d5edecf4f5605c810a4c36145c1d91 (diff)
parentd66d1b97aa5c30e4222d1d57d3d2e0f7522c998f (diff)
downloadphp-git-6fe457f3234c7124b5138295870c1e76c3858074.tar.gz
Merge branch 'PHP-7.0'
* PHP-7.0: Fixed incorrect order of free/finally on exception
Diffstat (limited to 'Zend/zend_vm_execute.h')
-rw-r--r--Zend/zend_vm_execute.h19
1 files changed, 13 insertions, 6 deletions
diff --git a/Zend/zend_vm_execute.h b/Zend/zend_vm_execute.h
index 813879f0a1..cc0193bfcd 100644
--- a/Zend/zend_vm_execute.h
+++ b/Zend/zend_vm_execute.h
@@ -1514,11 +1514,12 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_HANDLE_EXCEPTION_SPEC_HANDLER(
}
}
- i_cleanup_unfinished_execution(execute_data, op_num, catch_op_num);
+ cleanup_unfinished_calls(execute_data, op_num);
if (finally_op_num && (!catch_op_num || catch_op_num >= finally_op_num)) {
zval *fast_call = EX_VAR(EX(func)->op_array.opcodes[finally_op_end].op1.var);
+ cleanup_live_vars(execute_data, op_num, finally_op_num);
if (in_finally && Z_OBJ_P(fast_call)) {
zend_exception_set_previous(EG(exception), Z_OBJ_P(fast_call));
}
@@ -1528,6 +1529,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_HANDLE_EXCEPTION_SPEC_HANDLER(
ZEND_VM_SET_OPCODE(&EX(func)->op_array.opcodes[finally_op_num]);
ZEND_VM_CONTINUE();
} else {
+ cleanup_live_vars(execute_data, op_num, catch_op_num);
if (in_finally) {
/* we are going out of current finally scope */
zval *fast_call = EX_VAR(EX(func)->op_array.opcodes[finally_op_end].op1.var);
@@ -1639,20 +1641,25 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_FAST_RET_SPEC_HANDLER(ZEND_OPC
USE_OPLINE
if (opline->extended_value == ZEND_FAST_RET_TO_FINALLY) {
+ cleanup_live_vars(execute_data, opline - EX(func)->op_array.opcodes, opline->op2.opline_num);
ZEND_VM_SET_OPCODE(&EX(func)->op_array.opcodes[opline->op2.opline_num]);
ZEND_VM_CONTINUE();
} else {
EG(exception) = Z_OBJ_P(fast_call);
Z_OBJ_P(fast_call) = NULL;
if (opline->extended_value == ZEND_FAST_RET_TO_CATCH) {
+ cleanup_live_vars(execute_data, opline - EX(func)->op_array.opcodes, opline->op2.opline_num);
ZEND_VM_SET_OPCODE(&EX(func)->op_array.opcodes[opline->op2.opline_num]);
ZEND_VM_CONTINUE();
- } else if (UNEXPECTED((EX(func)->op_array.fn_flags & ZEND_ACC_GENERATOR) != 0)) {
- zend_generator *generator = zend_get_running_generator(execute_data);
- zend_generator_close(generator, 1);
- ZEND_VM_RETURN();
} else {
- ZEND_VM_TAIL_CALL(zend_leave_helper_SPEC(ZEND_OPCODE_HANDLER_ARGS_PASSTHRU));
+ cleanup_live_vars(execute_data, opline - EX(func)->op_array.opcodes, 0);
+ if (UNEXPECTED((EX(func)->op_array.fn_flags & ZEND_ACC_GENERATOR) != 0)) {
+ zend_generator *generator = zend_get_running_generator(execute_data);
+ zend_generator_close(generator, 1);
+ ZEND_VM_RETURN();
+ } else {
+ ZEND_VM_TAIL_CALL(zend_leave_helper_SPEC(ZEND_OPCODE_HANDLER_ARGS_PASSTHRU));
+ }
}
}
}