[php-src] master: Merge branch 'PHP-8.6'
| From: | Weilin Du | Date: | Mon, 09 Nov 2026 12:30:09 +0000 |
| Subject: | [php-src] master: Merge branch 'PHP-8.6' | ||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-143474@lists.php.net to get a copy of this message | ||
Author: Weilin Du (LamentXU123)
Date: 2026-11-09T20:23:22+08:00
Commit: https://github.com/php/php-src/commit/d6df3fa82fe8ffa346c0af6897b6b70f375937a7
Raw diff: https://github.com/php/php-src/commit/d6df3fa82fe8ffa346c0af6897b6b70f375937a7.diff
Merge branch 'PHP-8.6'
* PHP-8.6:
Fix use-after-free in zend_compile_const_decl() under opcache (#25302)
Changed paths:
M Zend/zend_compile.c
Diff:
diff --git a/Zend/zend_compile.c b/Zend/zend_compile.c
index 2977d54833dd..c2fa556c8c11 100644
--- a/Zend/zend_compile.c
+++ b/Zend/zend_compile.c
@@ -10517,12 +10517,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;