[php-src] master: Merge branch 'PHP-8.4' into PHP-8.5

From: Date: Mon, 09 Nov 2026 12:30:06 +0000
Subject: [php-src] master: Merge branch 'PHP-8.4' into PHP-8.5
Groups: php.cvs 
Request: Send a blank email to php-cvs+get-143472@lists.php.net to get a copy of this message
Author: Weilin Du (LamentXU123) Date: 2026-11-09T20:21:45+08:00 Commit: https://github.com/php/php-src/commit/084afea4ca23b397692825fa024e401ab46b0b05 Raw diff: https://github.com/php/php-src/commit/084afea4ca23b397692825fa024e401ab46b0b05.diff Merge branch 'PHP-8.4' into PHP-8.5 * PHP-8.4: Fix use-after-free in zend_compile_const_decl() under opcache (#25302) Changed paths: M NEWS M Zend/zend_compile.c Diff: diff --git a/NEWS b/NEWS index 4ed7877b6797..f47d51bc7d2e 100644 --- a/NEWS +++ b/NEWS @@ -16,6 +16,8 @@ PHP NEWS cached). (lazerg) . Fixed bug GH-25265 (Misaligned read for virtual internal props in hooked subclass). (Lazizbek Ergashev) + . Fixed bug GH-25302 (Use-after-free in zend_compile_const_decl() with + OPcache during concurrent compilation). (Nicolas Grekas) - Curl: . Fixed curl_reset() retaining CURLOPT_PRIVATE after reset. (lacatoire) diff --git a/Zend/zend_compile.c b/Zend/zend_compile.c index 89220cb48aa9..eeefd212d927 100644 --- a/Zend/zend_compile.c +++ b/Zend/zend_compile.c @@ -9715,12 +9715,15 @@ static void zend_compile_const_decl(zend_ast *ast) /* {{{ */ } } + /* Register before the literal takes the name: interning it there may + * release it, when opcache has put the same string in shared memory + * since the call above. */ + zend_register_seen_symbol(name, ZEND_SYMBOL_CONST); + name_node.op_type = IS_CONST; ZVAL_STR(&name_node.u.constant, name); last_op = zend_emit_op(NULL, ZEND_DECLARE_CONST, &name_node, &value_node); - - zend_register_seen_symbol(name, ZEND_SYMBOL_CONST); } if (attributes_ast == NULL) { return;

« previous php.cvs (#143472) next »