Skip to content

Commit a0a8624

Browse files
authored
Fix throw in IS_IDENTICAL in JIT (php#15103)
We need to persist opline in case zend_is_identical() throws.
1 parent da72ac1 commit a0a8624

File tree

2 files changed

+8
-3
lines changed

2 files changed

+8
-3
lines changed

Zend/Optimizer/zend_inference.c

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4998,8 +4998,6 @@ ZEND_API bool zend_may_throw_ex(const zend_op *opline, const zend_ssa_op *ssa_op
49984998

49994999
switch (opline->opcode) {
50005000
case ZEND_NOP:
5001-
case ZEND_IS_IDENTICAL:
5002-
case ZEND_IS_NOT_IDENTICAL:
50035001
case ZEND_QM_ASSIGN:
50045002
case ZEND_JMP:
50055003
case ZEND_CHECK_VAR:
@@ -5021,10 +5019,14 @@ ZEND_API bool zend_may_throw_ex(const zend_op *opline, const zend_ssa_op *ssa_op
50215019
case ZEND_FUNC_NUM_ARGS:
50225020
case ZEND_FUNC_GET_ARGS:
50235021
case ZEND_COPY_TMP:
5024-
case ZEND_CASE_STRICT:
50255022
case ZEND_JMP_NULL:
50265023
case ZEND_JMP_FRAMELESS:
50275024
return 0;
5025+
case ZEND_IS_IDENTICAL:
5026+
case ZEND_IS_NOT_IDENTICAL:
5027+
case ZEND_CASE_STRICT:
5028+
/* Array to array comparison may lead to recursion. */
5029+
return (t1 & t2) & MAY_BE_ARRAY_OF_ARRAY;
50285030
case ZEND_SEND_VAR:
50295031
case ZEND_SEND_VAL:
50305032
case ZEND_SEND_REF:

ext/opcache/jit/zend_jit_ir.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7335,6 +7335,9 @@ static int zend_jit_identical(zend_jit_ctx *jit,
73357335
}
73367336
op2_addr = real_addr;
73377337
}
7338+
if (may_throw) {
7339+
jit_SET_EX_OPLINE(jit, opline);
7340+
}
73387341

73397342
ref = ir_CALL_2(IR_BOOL, ir_CONST_FC_FUNC(zend_is_identical),
73407343
jit_ZVAL_ADDR(jit, op1_addr),

0 commit comments

Comments
 (0)