summaryrefslogtreecommitdiff
path: root/Zend/zend_compile.c
diff options
context:
space:
mode:
authorDmitry Stogov <dmitry@zend.com>2016-05-13 14:38:43 +0300
committerDmitry Stogov <dmitry@zend.com>2016-05-13 14:38:43 +0300
commitbe071702b30e9ba9bf9f9c9831f3301af039b1d5 (patch)
tree0c55550a9cc926c5b409b2c01bf22521265c5bf6 /Zend/zend_compile.c
parente9c3f9fcde1013cc1c9bdead7e16478a108d7907 (diff)
downloadphp-git-be071702b30e9ba9bf9f9c9831f3301af039b1d5.tar.gz
Fixed bug #72188 (Nested try/finally blocks losing return value)
Diffstat (limited to 'Zend/zend_compile.c')
-rw-r--r--Zend/zend_compile.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/Zend/zend_compile.c b/Zend/zend_compile.c
index c534088b58..7ae54da5bb 100644
--- a/Zend/zend_compile.c
+++ b/Zend/zend_compile.c
@@ -4532,6 +4532,7 @@ void zend_compile_try(zend_ast *ast) /* {{{ */
zend_op *opline;
uint32_t try_catch_offset;
uint32_t *jmp_opnums = safe_emalloc(sizeof(uint32_t), catches->children, 0);
+ uint32_t orig_fast_call_var = CG(context).fast_call_var;
if (catches->children == 0 && !finally_ast) {
zend_error_noreturn(E_COMPILE_ERROR, "Cannot use try without catch or finally");
@@ -4554,8 +4555,8 @@ void zend_compile_try(zend_ast *ast) /* {{{ */
zend_loop_var fast_call;
if (!(CG(active_op_array)->fn_flags & ZEND_ACC_HAS_FINALLY_BLOCK)) {
CG(active_op_array)->fn_flags |= ZEND_ACC_HAS_FINALLY_BLOCK;
- CG(context).fast_call_var = get_temporary_variable(CG(active_op_array));
}
+ CG(context).fast_call_var = get_temporary_variable(CG(active_op_array));
/* Push FAST_CALL on unwind stack */
fast_call.opcode = ZEND_FAST_CALL;
@@ -4665,6 +4666,8 @@ void zend_compile_try(zend_ast *ast) /* {{{ */
opline->op1.var = CG(context).fast_call_var;
zend_update_jump_target_to_next(opnum_jmp);
+
+ CG(context).fast_call_var = orig_fast_call_var;
}
efree(jmp_opnums);