[php-src] master: Merge branch 'PHP-8.6'
| From: | Jorg Sowa | Date: | Sat, 31 Oct 2026 14:58:26 +0000 |
| Subject: | [php-src] master: Merge branch 'PHP-8.6' | ||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-143066@lists.php.net to get a copy of this message | ||
Author: Jorg Sowa (jorgsowa)
Date: 2026-10-31T15:56:18+01:00
Commit: https://github.com/php/php-src/commit/52b13a7453146d30dbec4c363a2ba30ece446bd5
Raw diff: https://github.com/php/php-src/commit/52b13a7453146d30dbec4c363a2ba30ece446bd5.diff
Merge branch 'PHP-8.6'
# Conflicts:
# NEWS
Changed paths:
A Zend/tests/assert/expect_final_abstract_modifiers.phpt
M Zend/zend_ast.c
Diff:
diff --git a/Zend/tests/assert/expect_final_abstract_modifiers.phpt
b/Zend/tests/assert/expect_final_abstract_modifiers.phpt
new file mode 100644
index 000000000000..5dd87976faf5
--- /dev/null
+++ b/Zend/tests/assert/expect_final_abstract_modifiers.phpt
@@ -0,0 +1,36 @@
+--TEST--
+AST printing of final and abstract modifiers on class constants and properties
+--INI--
+zend.assertions=1
+--FILE--
+<?php
+
+try {
+ assert(false && new class {
+ final public const A = 1;
+ final protected const int B = 2;
+ final public $a;
+ final public static $b;
+ final public readonly int $c;
+ abstract public $d { get; }
+ abstract protected private(set) int $e { set; }
+ });
+} catch (AssertionError $e) {
+ echo $e->getMessage(), "\n";
+}
+
+?>
+--EXPECT--
+assert(false && new class {
+ public final const A = 1;
+ protected final const int B = 2;
+ public final $a;
+ public static final $b;
+ public final readonly int $c;
+ public abstract $d {
+ get;
+ }
+ protected private(set) abstract int $e {
+ set;
+ }
+})
diff --git a/Zend/zend_ast.c b/Zend/zend_ast.c
index 9b1006e9f5c1..76ba83395ccd 100644
--- a/Zend/zend_ast.c
+++ b/Zend/zend_ast.c
@@ -2478,6 +2478,12 @@ static ZEND_COLD void zend_ast_export_ex(smart_str *str, zend_ast *ast, int
prio
if (ast->attr & ZEND_ACC_STATIC) {
smart_str_appends(str, "static ");
}
+ if (ast->attr & ZEND_ACC_ABSTRACT) {
+ smart_str_appends(str, "abstract ");
+ }
+ if (ast->attr & ZEND_ACC_FINAL) {
+ smart_str_appends(str, "final ");
+ }
if (ast->attr & ZEND_ACC_READONLY) {
smart_str_appends(str, "readonly ");
}
@@ -2517,6 +2523,9 @@ static ZEND_COLD void zend_ast_export_ex(smart_str *str, zend_ast *ast, int
prio
}
zend_ast_export_visibility(str, ast->attr, ZEND_MODIFIER_TARGET_CONSTANT);
+ if (ast->attr & ZEND_ACC_FINAL) {
+ smart_str_appends(str, "final ");
+ }
smart_str_appends(str, "const ");
if (ast->child[2]) {
zend_ast_export_type(str, ast->child[2], indent);