diff --git a/ext/opcache/jit/zend_jit_trace.c b/ext/opcache/jit/zend_jit_trace.c index da66a903c170a..8f20c85da05b1 100644 --- a/ext/opcache/jit/zend_jit_trace.c +++ b/ext/opcache/jit/zend_jit_trace.c @@ -8585,7 +8585,7 @@ int ZEND_FASTCALL zend_jit_trace_exit(uint32_t exit_num, zend_jit_registers_buf if (op->opcode == ZEND_FETCH_DIM_IS || op->opcode == ZEND_FETCH_OBJ_IS) { ZVAL_NULL(EX_VAR_NUM(i)); } else { - assert(op->opcode == ZEND_FETCH_DIM_R || op->opcode == ZEND_FETCH_LIST_R || op->opcode == ZEND_FETCH_OBJ_R); + ZEND_ASSERT(op->opcode == ZEND_FETCH_DIM_R || op->opcode == ZEND_FETCH_LIST_R || op->opcode == ZEND_FETCH_OBJ_R || op->opcode == ZEND_FETCH_DIM_FUNC_ARG || op->opcode == ZEND_FETCH_OBJ_FUNC_ARG); repeat_last_opline = 1; } } else { diff --git a/ext/opcache/tests/jit/gh17140_1.phpt b/ext/opcache/tests/jit/gh17140_1.phpt new file mode 100644 index 0000000000000..a37277f69ba9a --- /dev/null +++ b/ext/opcache/tests/jit/gh17140_1.phpt @@ -0,0 +1,33 @@ +--TEST-- +GH-17140 (Assertion failure in JIT trace exit with ZEND_FETCH_DIM_FUNC_ARG) +--EXTENSIONS-- +opcache +--INI-- +opcache.jit=1254 +opcache.jit_buffer_size=32M +opcache.jit_hot_func=1 +opcache.jit_hot_side_exit=1 +--FILE-- + +--EXPECTF-- +Warning: Undefined variable $i in %s on line %d + +Warning: Undefined array key 0 in %s on line %d +NULL + +Warning: Undefined variable $i in %s on line %d + +Warning: Undefined array key 0 in %s on line %d +NULL + +Warning: Undefined array key 0 in %s on line %d +NULL diff --git a/ext/opcache/tests/jit/gh17140_2.phpt b/ext/opcache/tests/jit/gh17140_2.phpt new file mode 100644 index 0000000000000..b47f808c723ee --- /dev/null +++ b/ext/opcache/tests/jit/gh17140_2.phpt @@ -0,0 +1,40 @@ +--TEST-- +GH-17140 (Assertion failure in JIT trace exit with ZEND_FETCH_DIM_FUNC_ARG) +--EXTENSIONS-- +opcache +--INI-- +opcache.jit=1254 +opcache.jit_buffer_size=32M +opcache.jit_hot_func=1 +opcache.jit_hot_side_exit=1 +--FILE-- +b); + } +} +function test() { + $a['x'] = new X; + for ($fusion = 0; $i < 3; $i++) { + var_dump($a['x']->b); + } +} +test(); +?> +--EXPECTF-- +Warning: Undefined variable $i in %s on line %d + +Warning: Undefined property: Foo\X::$b in %s on line %d +NULL + +Warning: Undefined variable $i in %s on line %d + +Warning: Undefined property: Foo\X::$b in %s on line %d +NULL + +Warning: Undefined property: Foo\X::$b in %s on line %d +NULL