Commit 0595913128c for php
commit 0595913128c00717571412af2180e3018904271b
Merge: f3df6c15be5 d4f793edfd0
Author: Jorg Sowa <jorg.sowa@gmail.com>
Date: Thu Nov 5 22:06:28 2026 +0100
Merge branch 'PHP-8.5' into PHP-8.6
# Conflicts:
# Zend/zend_ast.c
diff --cc Zend/zend_ast.c
index 2dc2e4b97bb,e48ec13e98d..051e9e61266
--- a/Zend/zend_ast.c
+++ b/Zend/zend_ast.c
@@@ -1880,13 -1634,36 +1880,31 @@@ static ZEND_COLD bool zend_ast_valid_va
(c < '0' || c > '9') &&
(c < 'A' || c > 'Z') &&
(c < 'a' || c > 'z')) {
- return 0;
+ return false;
}
}
- return 1;
-}
-
-static ZEND_COLD bool zend_ast_var_needs_braces(char ch)
-{
- return ch == '[' || zend_ast_valid_var_char(ch);
+ return true;
}
+ static ZEND_COLD void zend_ast_export_class_const_name(smart_str *str, zend_ast *ast, int indent)
+ {
+ if (ast->kind == ZEND_AST_ZVAL) {
+ const zval *zv = zend_ast_get_zval(ast);
+
+ /* A bare "class" would turn the dynamic fetch into a class name fetch. */
+ if (Z_TYPE_P(zv) == IS_STRING
+ && zend_ast_valid_var_name(Z_STRVAL_P(zv), Z_STRLEN_P(zv))
+ && !zend_string_equals_ci(Z_STR_P(zv), ZSTR_KNOWN(ZEND_STR_CLASS))) {
+ smart_str_append(str, Z_STR_P(zv));
+ return;
+ }
+ }
+ smart_str_appendc(str, '{');
+ zend_ast_export_ex(str, ast, 0, indent);
+ smart_str_appendc(str, '}');
+ }
+
-static ZEND_COLD void zend_ast_export_var(smart_str *str, zend_ast *ast, int priority, int indent)
+static ZEND_COLD void zend_ast_export_var(smart_str *str, zend_ast *ast, int indent)
{
if (ast->kind == ZEND_AST_ZVAL) {
zval *zv = zend_ast_get_zval(ast);
@@@ -2716,15 -2497,19 +2734,15 @@@ simple_list
smart_str_appendc(str, ')');
break;
}
- case ZEND_AST_PARENT_PROPERTY_HOOK_CALL:
- smart_str_append(str, Z_STR_P(zend_ast_get_zval(ast->child[0])));
- smart_str_appendc(str, '(');
- zend_ast_export_ex(str, ast->child[1], 0, indent);
- smart_str_appendc(str, ')');
- break;
- case ZEND_AST_CALLABLE_CONVERT:
- smart_str_appends(str, "...");
- break;
+ case ZEND_AST_CALLABLE_CONVERT: {
+ zend_ast_fcc *fcc_ast = (zend_ast_fcc*)ast;
+ ast = fcc_ast->args;
+ goto simple_list;
+ }
case ZEND_AST_CLASS_CONST:
- zend_ast_export_ns_name(str, ast->child[0], 0, indent);
+ zend_ast_export_ns_name_or_expression(str, ast->child[0], 0, indent);
smart_str_appends(str, "::");
- zend_ast_export_name(str, ast->child[1], 0, indent);
+ zend_ast_export_class_const_name(str, ast->child[1], indent);
break;
case ZEND_AST_CLASS_NAME:
if (ast->child[0] == NULL) {