diff options
author | Dmitry Stogov <dmitry@php.net> | 2008-05-05 11:03:35 +0000 |
---|---|---|
committer | Dmitry Stogov <dmitry@php.net> | 2008-05-05 11:03:35 +0000 |
commit | 1b317f15264e72470291885e2da81d19873e1074 (patch) | |
tree | b25fd0968ac37a797a04f0eb3d0c22723a24c02c /Zend/zend_execute.c | |
parent | af371c9f5e662f7a05a658c96b1ba7af5ba4dd8a (diff) | |
download | php-git-1b317f15264e72470291885e2da81d19873e1074.tar.gz |
- Use ZEND_FREE() opcode instead of ZEND_SWITCH_FREE(IS_TMP_VAR)
- Fixed bug #44913 (Segfault when using return in combination with nested loops
and continue 2)
Diffstat (limited to 'Zend/zend_execute.c')
-rw-r--r-- | Zend/zend_execute.c | 32 |
1 files changed, 16 insertions, 16 deletions
diff --git a/Zend/zend_execute.c b/Zend/zend_execute.c index 2391fc08cc..bf8884907c 100644 --- a/Zend/zend_execute.c +++ b/Zend/zend_execute.c @@ -377,22 +377,18 @@ static inline zval *_get_obj_zval_ptr(znode *op, temp_variable *Ts, zend_free_op return get_zval_ptr(op, Ts, should_free, type); } -static inline void zend_switch_free(temp_variable *T, int type, int extended_value TSRMLS_DC) +static inline void zend_switch_free(temp_variable *T, int extended_value TSRMLS_DC) { - if (type == IS_VAR) { - if (T->var.ptr) { - if (extended_value & ZEND_FE_RESET_VARIABLE) { /* foreach() free */ - Z_DELREF_P(T->var.ptr); - } - zval_ptr_dtor(&T->var.ptr); - } else if (!T->var.ptr_ptr) { - /* perform the equivalent of equivalent of a - * quick & silent get_zval_ptr, and FREE_OP - */ - PZVAL_UNLOCK_FREE(T->str_offset.str); + if (T->var.ptr) { + if (extended_value & ZEND_FE_RESET_VARIABLE) { /* foreach() free */ + Z_DELREF_P(T->var.ptr); } - } else { /* IS_TMP_VAR */ - zendi_zval_dtor(T->tmp_var); + zval_ptr_dtor(&T->var.ptr); + } else if (!T->var.ptr_ptr) { + /* perform the equivalent of equivalent of a + * quick & silent get_zval_ptr, and FREE_OP + */ + PZVAL_UNLOCK_FREE(T->str_offset.str); } } @@ -1241,10 +1237,14 @@ static inline zend_brk_cont_element* zend_brk_cont(zval *nest_levels_zval, int a switch (brk_opline->opcode) { case ZEND_SWITCH_FREE: - zend_switch_free(&T(brk_opline->op1.u.var), brk_opline->op1.op_type, brk_opline->extended_value TSRMLS_CC); + if (brk_opline->op1.u.EA.type != EXT_TYPE_FREE_ON_RETURN) { + zend_switch_free(&T(brk_opline->op1.u.var), brk_opline->extended_value TSRMLS_CC); + } break; case ZEND_FREE: - zendi_zval_dtor(T(brk_opline->op1.u.var).tmp_var); + if (brk_opline->op1.u.EA.type != EXT_TYPE_FREE_ON_RETURN) { + zendi_zval_dtor(T(brk_opline->op1.u.var).tmp_var); + } break; } } |