Skip to content

Commit 307c734

Browse files
committed
Better way to fix (Fix bug #69871 (short-circuiting failure with smart_branch))
1 parent 235c7ed commit 307c734

File tree

1 file changed

+1
-18
lines changed

1 file changed

+1
-18
lines changed

Zend/zend_compile.c

Lines changed: 1 addition & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -5900,25 +5900,8 @@ void zend_compile_short_circuiting(znode *result, zend_ast *ast) /* {{{ */
59005900
opline_jmpz->result_type = IS_TMP_VAR;
59015901
}
59025902

5903-
zend_compile_expr(&right_node, right_ast);
5904-
5905-
if (right_node.op_type == IS_CONST && opnum_jmpz == get_next_op_number(CG(active_op_array)) - 1) {
5906-
if ((ast->kind == ZEND_AST_AND && !zend_is_true(&right_node.u.constant))
5907-
|| (ast->kind == ZEND_AST_OR && zend_is_true(&right_node.u.constant))) {
5908-
CG(active_op_array)->last--;
5909-
result->op_type = IS_CONST;
5910-
ZVAL_BOOL(&result->u.constant, zend_is_true(&right_node.u.constant));
5911-
} else {
5912-
opline_jmpz->opcode = ZEND_BOOL;
5913-
zend_make_var_result(result, opline_jmpz);
5914-
}
5915-
5916-
zval_ptr_dtor(&right_node.u.constant);
5917-
return;
5918-
}
5919-
5920-
opline_jmpz = &CG(active_op_array)->opcodes[opnum_jmpz];
59215903
GET_NODE(result, opline_jmpz->result);
5904+
zend_compile_expr(&right_node, right_ast);
59225905

59235906
opline_bool = zend_emit_op(NULL, ZEND_BOOL, &right_node, NULL);
59245907
SET_NODE(opline_bool->result, result);

0 commit comments

Comments
 (0)