Skip to content

Commit 755f4e6

Browse files
committed
Merge branch 'PHP-8.5'
* PHP-8.5: Fix GH-22071: JIT assertion on abstract static method call.
2 parents 900afbb + 38e0aca commit 755f4e6

2 files changed

Lines changed: 21 additions & 1 deletion

File tree

Zend/Optimizer/zend_optimizer.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -943,7 +943,7 @@ zend_function *zend_optimizer_get_called_func(
943943
if (ce) {
944944
zend_string *func_name = Z_STR_P(CRT_CONSTANT(opline->op2) + 1);
945945
zend_function *fbc = zend_hash_find_ptr(&ce->function_table, func_name);
946-
if (fbc) {
946+
if (fbc && !(fbc->common.fn_flags & ZEND_ACC_ABSTRACT)) {
947947
bool is_public = (fbc->common.fn_flags & ZEND_ACC_PUBLIC) != 0;
948948
bool same_scope = fbc->common.scope == op_array->scope;
949949
if (is_public || same_scope) {

ext/opcache/tests/gh22071.phpt

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
--TEST--
2+
GH-22071: Assertion failure jit_CONST_FUNC_PROTO on abstract static method call
3+
--CREDITS--
4+
YuanchengJiang
5+
--EXTENSIONS--
6+
opcache
7+
--INI--
8+
opcache.enable=1
9+
opcache.enable_cli=1
10+
opcache.jit=1205
11+
opcache.jit_buffer_size=16M
12+
--FILE--
13+
<?php
14+
try {
15+
$e = enum_exists('UnitEnum') ? UnitEnum::cases() : [];
16+
} catch (\Throwable $_e) {}
17+
echo "ok\n";
18+
?>
19+
--EXPECT--
20+
ok

0 commit comments

Comments
 (0)