diff --git a/ext/opcache/jit/zend_jit.c b/ext/opcache/jit/zend_jit.c index 4a327389434..9afe38f701c 100644 --- a/ext/opcache/jit/zend_jit.c +++ b/ext/opcache/jit/zend_jit.c @@ -2760,8 +2760,8 @@ static int zend_jit(const zend_op_array *op_array, zend_ssa *ssa, const zend_op /* THROW and EXIT may be used in the middle of BB */ /* don't generate code for the rest of BB */ - /* Skip current opline for call_level computation - * Don't include last opline because end of loop already checks call level of last opline */ + /* Skip current opline for call_level computation because it does not influence call_level. + * Don't include last opline because end of loop already checks call level of last opline. */ i++; for (; i < end; i++) { opline = op_array->opcodes + i; @@ -2771,7 +2771,7 @@ static int zend_jit(const zend_op_array *op_array, zend_ssa *ssa, const zend_op call_level--; } } - opline = op_array->opcodes + i; + opline = op_array->opcodes + end; break; /* stackless execution */ case ZEND_INCLUDE_OR_EVAL: diff --git a/ext/opcache/tests/jit/gh17428.phpt b/ext/opcache/tests/jit/gh17428.phpt new file mode 100644 index 00000000000..21bb1867632 --- /dev/null +++ b/ext/opcache/tests/jit/gh17428.phpt @@ -0,0 +1,35 @@ +--TEST-- +GH-17428 (Assertion failure ext/opcache/jit/zend_jit_ir.c:8940) +--EXTENSIONS-- +opcache +--INI-- +opcache.jit=1205 +--FILE-- + +--EXPECTF-- +Fatal error: Uncaught Error: Call to undefined function testConversion() in %s:%d +Stack trace: +#0 {main} + thrown in %s on line %d