diff options
| author | Dmitry Stogov <dmitry@zend.com> | 2015-07-10 04:13:34 +0300 |
|---|---|---|
| committer | Dmitry Stogov <dmitry@zend.com> | 2015-07-10 04:13:34 +0300 |
| commit | 44f7348caa188d6c2b6228eaa622d0ef86b2647e (patch) | |
| tree | f1e6b1b9c577f30a68dab8a458223d29d36bcf03 /Zend/zend_compile.c | |
| parent | 3bb70fe2903acf2caf2600345f07943f34a3b23c (diff) | |
| download | php-git-44f7348caa188d6c2b6228eaa622d0ef86b2647e.tar.gz | |
Exception thrown by "return" statement (from TMP destructors) shouldn't be caught in the same function
Diffstat (limited to 'Zend/zend_compile.c')
| -rw-r--r-- | Zend/zend_compile.c | 15 |
1 files changed, 13 insertions, 2 deletions
diff --git a/Zend/zend_compile.c b/Zend/zend_compile.c index 0927f0cd23..44807d359b 100644 --- a/Zend/zend_compile.c +++ b/Zend/zend_compile.c @@ -3514,9 +3514,20 @@ void zend_compile_unset(zend_ast *ast) /* {{{ */ } /* }}} */ -static void zend_free_foreach_and_switch_variables(void) /* {{{ */ +static void zend_free_foreach_and_switch_variables(uint32_t flags) /* {{{ */ { + uint32_t start_op_number = get_next_op_number(CG(active_op_array)); + zend_stack_apply(&CG(loop_var_stack), ZEND_STACK_APPLY_TOPDOWN, (int (*)(void *element)) generate_free_loop_var); + + if (flags) { + uint32_t end_op_number = get_next_op_number(CG(active_op_array)); + + while (start_op_number < end_op_number) { + CG(active_op_array)->opcodes[start_op_number].extended_value |= flags; + start_op_number++; + } + } } /* }}} */ @@ -3538,7 +3549,7 @@ void zend_compile_return(zend_ast *ast) /* {{{ */ zend_compile_expr(&expr_node, expr_ast); } - zend_free_foreach_and_switch_variables(); + zend_free_foreach_and_switch_variables(ZEND_FREE_ON_RETURN); if (CG(context).in_finally) { opline = zend_emit_op(NULL, ZEND_DISCARD_EXCEPTION, NULL, NULL); |
