Skip to content

Commit 653a10a

Browse files
committed
Fix ZEND_IS op1 literal compaction
1 parent 36bd571 commit 653a10a

File tree

2 files changed

+5
-1
lines changed

2 files changed

+5
-1
lines changed

Zend/zend_compile.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5968,6 +5968,9 @@ static void zend_compile_match(znode *result, zend_ast *ast)
59685968

59695969
zend_op *opline = zend_emit_op_tmp(NULL, ZEND_IS, &expr_node, &pattern_node);
59705970
SET_NODE(opline->result, &case_node);
5971+
if (opline->op1_type == IS_CONST) {
5972+
Z_TRY_ADDREF_P(CT_CONSTANT(opline->op1));
5973+
}
59715974
}
59725975

59735976
jmpnz_opnums[cond_count] = zend_emit_cond_jump(ZEND_JMPNZ, &case_node, 0);

Zend/zend_opcode.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -878,7 +878,8 @@ static bool keeps_op1_alive(zend_op *opline) {
878878
|| opline->opcode == ZEND_SWITCH_STRING
879879
|| opline->opcode == ZEND_MATCH
880880
|| opline->opcode == ZEND_FETCH_LIST_R
881-
|| opline->opcode == ZEND_COPY_TMP) {
881+
|| opline->opcode == ZEND_COPY_TMP
882+
|| opline->opcode == ZEND_IS) {
882883
return 1;
883884
}
884885
ZEND_ASSERT(opline->opcode != ZEND_FE_FETCH_R

0 commit comments

Comments
 (0)