diff options
author | Xinchen Hui <laruence@gmail.com> | 2016-03-17 21:10:08 +0800 |
---|---|---|
committer | Xinchen Hui <laruence@gmail.com> | 2016-03-17 21:10:08 +0800 |
commit | 910e6dc6b83212bb42328e47c9a71b61014e80d5 (patch) | |
tree | ad434ad427d7e9819e695328750ccfa698c3127e | |
parent | aef22ac1c1f269e145d1f644e86c41712d8cfa12 (diff) | |
download | php-git-910e6dc6b83212bb42328e47c9a71b61014e80d5.tar.gz |
Fixed for master
-rw-r--r-- | Zend/zend_compile.c | 25 |
1 files changed, 19 insertions, 6 deletions
diff --git a/Zend/zend_compile.c b/Zend/zend_compile.c index 56da2962bd..1d7cd36381 100644 --- a/Zend/zend_compile.c +++ b/Zend/zend_compile.c @@ -611,16 +611,29 @@ static inline void zend_end_loop(int cont_addr) /* {{{ */ void zend_do_free(znode *op1) /* {{{ */ { - if (op1->op_type==IS_TMP_VAR) { - zend_op *opline = get_next_op(CG(active_op_array)); + if (op1->op_type == IS_TMP_VAR) { + zend_op *opline = &CG(active_op_array)->opcodes[CG(active_op_array)->last-1]; + + while (opline->opcode == ZEND_END_SILENCE) { + opline--; + } + + if (opline->result_type == IS_TMP_VAR && opline->result.var == op1->u.op.var) { + if (opline->opcode == ZEND_BOOL || opline->opcode == ZEND_BOOL_NOT) { + return; + } + } + + opline = get_next_op(CG(active_op_array)); opline->opcode = ZEND_FREE; SET_NODE(opline->op1, op1); SET_UNUSED(opline->op2); - } else if (op1->op_type==IS_VAR) { + } else if (op1->op_type == IS_VAR) { zend_op *opline = &CG(active_op_array)->opcodes[CG(active_op_array)->last-1]; - - while (opline->opcode == ZEND_END_SILENCE || opline->opcode == ZEND_EXT_FCALL_END || opline->opcode == ZEND_OP_DATA) { + while (opline->opcode == ZEND_END_SILENCE || + opline->opcode == ZEND_EXT_FCALL_END || + opline->opcode == ZEND_OP_DATA) { opline--; } if (opline->result_type == IS_VAR @@ -650,7 +663,7 @@ void zend_do_free(znode *op1) /* {{{ */ SET_UNUSED(opline->op2); return; } - if (opline->result_type==IS_VAR + if (opline->result_type == IS_VAR && opline->result.var == op1->u.op.var) { if (opline->opcode == ZEND_NEW) { opline->result_type |= EXT_TYPE_UNUSED; |