mirror of
https://github.com/php/php-src.git
synced 2025-08-15 13:38:49 +02:00
Fix JIT for INIT_STATIC_METHOD_CALL in a closure
This commit is contained in:
parent
5009c236fc
commit
d9e39f5c6f
2 changed files with 25 additions and 1 deletions
|
@ -9353,7 +9353,7 @@ static int zend_jit_init_static_method_call(zend_jit_ctx *jit,
|
||||||
if (opline->op1_type == IS_UNUSED
|
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_PARENT ||
|
||||||
(opline->op1.num & ZEND_FETCH_CLASS_MASK) == ZEND_FETCH_CLASS_SELF)) {
|
(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));
|
scope_ref = ir_LOAD_A(jit_EX(This.value.ref));
|
||||||
} else {
|
} else {
|
||||||
scope_ref = ir_LOAD_A(ir_ADD_OFFSET(ir_LOAD_A(jit_EX(This.value.ref)), offsetof(zend_object, ce)));
|
scope_ref = ir_LOAD_A(ir_ADD_OFFSET(ir_LOAD_A(jit_EX(This.value.ref)), offsetof(zend_object, ce)));
|
||||||
|
|
24
ext/opcache/tests/jit/init_static_method_call_001.phpt
Normal file
24
ext/opcache/tests/jit/init_static_method_call_001.phpt
Normal file
|
@ -0,0 +1,24 @@
|
||||||
|
--TEST--
|
||||||
|
JIT INIT_STATIC_METHOD_CALL: 001 Invalid scope
|
||||||
|
--INI--
|
||||||
|
opcache.enable=1
|
||||||
|
opcache.enable_cli=1
|
||||||
|
--EXTENSIONS--
|
||||||
|
opcache
|
||||||
|
--FILE--
|
||||||
|
<?php
|
||||||
|
class C {
|
||||||
|
public static function foo() {
|
||||||
|
$f = function() {
|
||||||
|
return call_user_func(self::bar(), 1, 2, 3, 4, 5);
|
||||||
|
};
|
||||||
|
return $f();
|
||||||
|
}
|
||||||
|
public static function bar() {
|
||||||
|
return function($a, $b, $c, $d, $e) {return $a + $b + $c + $d + $e;};
|
||||||
|
}
|
||||||
|
}
|
||||||
|
var_dump(C::foo());
|
||||||
|
?>
|
||||||
|
--EXPECT--
|
||||||
|
int(15)
|
Loading…
Add table
Add a link
Reference in a new issue