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

From: Date: Mon, 09 Nov 2026 12:30:07 +0000
Subject: [php-src] PHP-8.6: Merge branch 'PHP-8.5' into PHP-8.6
Groups: php.cvs 
Request: Send a blank email to php-cvs+get-143473@lists.php.net to get a copy of this message
Author: Weilin Du (LamentXU123) Date: 2026-11-09T20:22:32+08:00 Commit: https://github.com/php/php-src/commit/1f1d646bb2816f08711cb1aa78859484357ed30a Raw diff: https://github.com/php/php-src/commit/1f1d646bb2816f08711cb1aa78859484357ed30a.diff Merge branch 'PHP-8.5' into PHP-8.6 * PHP-8.5: 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 fad1371c62a8..444a3c9d1ad4 100644 --- a/NEWS +++ b/NEWS @@ -21,6 +21,8 @@ PHP NEWS . Fix support for never-returning functions in PFAs. (ndossche) . Fixed array_map() optimization not resolving the function name of an FCC. (ChrisAbner) + . 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 9a0d330f04bf..98732f060170 100644 --- a/Zend/zend_compile.c +++ b/Zend/zend_compile.c @@ -10464,12 +10464,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 (#143473) next »