diff --git a/ext/opcache/jit/zend_jit_ir.c b/ext/opcache/jit/zend_jit_ir.c index 4ef32415abe..a3aae9b921f 100644 --- a/ext/opcache/jit/zend_jit_ir.c +++ b/ext/opcache/jit/zend_jit_ir.c @@ -9353,7 +9353,7 @@ static int zend_jit_init_static_method_call(zend_jit_ctx *jit, if (opline->op1_type == IS_UNUSED && ((opline->op1.num & ZEND_FETCH_CLASS_MASK) == ZEND_FETCH_CLASS_PARENT || (opline->op1.num & ZEND_FETCH_CLASS_MASK) == ZEND_FETCH_CLASS_SELF)) { - if (op_array->fn_flags & ZEND_ACC_STATIC) { + if (!op_array->scope || (op_array->fn_flags & ZEND_ACC_STATIC)) { scope_ref = ir_LOAD_A(jit_EX(This.value.ref)); } else { scope_ref = ir_LOAD_A(ir_ADD_OFFSET(ir_LOAD_A(jit_EX(This.value.ref)), offsetof(zend_object, ce))); diff --git a/ext/opcache/tests/jit/init_static_method_call_001.phpt b/ext/opcache/tests/jit/init_static_method_call_001.phpt new file mode 100644 index 00000000000..b6f1b95cc1e --- /dev/null +++ b/ext/opcache/tests/jit/init_static_method_call_001.phpt @@ -0,0 +1,24 @@ +--TEST-- +JIT INIT_STATIC_METHOD_CALL: 001 Invalid scope +--INI-- +opcache.enable=1 +opcache.enable_cli=1 +--EXTENSIONS-- +opcache +--FILE-- + +--EXPECT-- +int(15)