[php-src] master: Merge branch 'PHP-8.6'

From: Date: Sun, 08 Nov 2026 16:34:54 +0000
Subject: [php-src] master: Merge branch 'PHP-8.6'
Groups: php.cvs 
Request: Send a blank email to php-cvs+get-143452@lists.php.net to get a copy of this message
Author: Weilin Du (LamentXU123) Date: 2026-11-09T00:34:06+08:00 Commit: https://github.com/php/php-src/commit/96d645e17e0714f2f975c3985c003a9ff01aad8a Raw diff: https://github.com/php/php-src/commit/96d645e17e0714f2f975c3985c003a9ff01aad8a.diff Merge branch 'PHP-8.6' * PHP-8.6: Fix GH-25253: JIT reads parent of an unlinked class (#25259) Changed paths: A ext/opcache/tests/jit/gh25253.inc A ext/opcache/tests/jit/gh25253.phpt M ext/opcache/jit/zend_jit.c Diff: diff --git a/ext/opcache/jit/zend_jit.c b/ext/opcache/jit/zend_jit.c index 47921d5a7104..d5d61c3289bb 100644 --- a/ext/opcache/jit/zend_jit.c +++ b/ext/opcache/jit/zend_jit.c @@ -592,7 +592,7 @@ static zend_class_entry* zend_get_known_class(const zend_op_array *op_array, con ZEND_ASSERT((op.num & ZEND_FETCH_CLASS_MASK) == ZEND_FETCH_CLASS_PARENT); ce = op_array->scope; if (ce) { - if (ce->parent) { + if ((ce->ce_flags & ZEND_ACC_LINKED) && ce->parent) { ce = ce->parent; if (ce->type == ZEND_INTERNAL_CLASS || ce->info.user.filename != op_array->filename) { ce = NULL; diff --git a/ext/opcache/tests/jit/gh25253.inc b/ext/opcache/tests/jit/gh25253.inc new file mode 100644 index 000000000000..64db08b7513d --- /dev/null +++ b/ext/opcache/tests/jit/gh25253.inc @@ -0,0 +1,10 @@ +<?php + +class GH25253Child extends GH25253ParentClass { + public function m0() { return parent::m0(); } + public function m1() { return parent::m1(); } + public function m2() { return parent::m2(); } + public function m3() { return parent::m3(); } + public function m4() { return parent::m4(); } + public function m5() { return parent::m5(); } +} diff --git a/ext/opcache/tests/jit/gh25253.phpt b/ext/opcache/tests/jit/gh25253.phpt new file mode 100644 index 000000000000..eb6c7c525ffc --- /dev/null +++ b/ext/opcache/tests/jit/gh25253.phpt @@ -0,0 +1,30 @@ +--TEST-- +GH-25253: JIT reads parent of an unlinked class +--INI-- +opcache.enable=1 +opcache.enable_cli=1 +opcache.file_update_protection=0 +opcache.interned_strings_buffer=0 +opcache.jit=function +--EXTENSIONS-- +opcache +--FILE-- +<?php + +class GH25253ParentClass { + public function m0() { return 'm0'; } + public function m1() { return 'm1'; } + public function m2() { return 'm2'; } + public function m3() { return 'm3'; } + public function m4() { return 'm4'; } + public function m5() { return 'm5'; } +} + +require __DIR__ . '/gh25253.inc'; + +$c = new GH25253Child; +echo $c->m0(), $c->m5(), "\n"; + +?> +--EXPECT-- +m0m5

« previous php.cvs (#143452) next »