Skip to content

Commit 1a79ea4

Browse files
authored
Fix GH-21411: opcache_compile_file() fails to early-bind classes without parents (#21412)
1 parent ae863ea commit 1a79ea4

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

ext/opcache/zend_accelerator_util_funcs.c

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -360,6 +360,12 @@ static void zend_accel_do_delayed_early_binding(
360360
: NULL;
361361
if (parent_ce || (orig_ce->ce_flags & ZEND_ACC_LINKED)) {
362362
ce = zend_try_early_bind(orig_ce, parent_ce, early_binding->lcname, zv);
363+
} else if (ZSTR_LEN(early_binding->lc_parent_name) == 0) {
364+
/* Parentless class: use the same binding path as the VM handler */
365+
zval lcname_zv[2];
366+
ZVAL_STR(&lcname_zv[0], early_binding->lcname);
367+
ZVAL_STR(&lcname_zv[1], early_binding->rtd_key);
368+
ce = zend_bind_class_in_slot(zv, lcname_zv, early_binding->lc_parent_name);
363369
}
364370
}
365371
if (ce && early_binding->cache_slot != (uint32_t) -1) {

0 commit comments

Comments
 (0)