Skip to content

Commit 0e6ec97

Browse files
committed
Check for undef variable exception in SEND_VAR JIT
Add a return value to zend_jit_undefined_op_helper(), so we can check for exception based on the return value, instead of fetching EG(exception).
1 parent cdc4ea2 commit 0e6ec97

File tree

2 files changed

+4
-1
lines changed

2 files changed

+4
-1
lines changed

ext/opcache/jit/zend_jit_helpers.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -278,12 +278,13 @@ static zval* ZEND_FASTCALL zend_jit_symtable_lookup_w(HashTable *ht, zend_string
278278
return retval;
279279
}
280280

281-
static void ZEND_FASTCALL zend_jit_undefined_op_helper(uint32_t var)
281+
static int ZEND_FASTCALL zend_jit_undefined_op_helper(uint32_t var)
282282
{
283283
const zend_execute_data *execute_data = EG(current_execute_data);
284284
zend_string *cv = EX(func)->op_array.vars[EX_VAR_TO_NUM(var)];
285285

286286
zend_error(E_WARNING, "Undefined variable $%s", ZSTR_VAL(cv));
287+
return EG(exception) == NULL;
287288
}
288289

289290
static void ZEND_FASTCALL zend_jit_fetch_dim_r_helper(zend_array *ht, zval *dim, zval *result)

ext/opcache/jit/zend_jit_x86.dasc

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9235,6 +9235,8 @@ static int zend_jit_send_var(dasm_State **Dst, const zend_op *opline, const zend
92359235
| mov FCARG1d, opline->op1.var
92369236
| EXT_CALL zend_jit_undefined_op_helper, r0
92379237
| SET_ZVAL_TYPE_INFO arg_addr, IS_NULL
9238+
| test r0, r0
9239+
| jz ->exception_handler
92389240

92399241
if (op1_info & (MAY_BE_ANY|MAY_BE_REF)) {
92409242
| jmp >7

0 commit comments

Comments
 (0)