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

From: Date: Sat, 31 Oct 2026 15:20:05 +0000
Subject: [php-src] master: Merge branch 'PHP-8.5' into PHP-8.6
Groups: php.cvs 
Request: Send a blank email to php-cvs+get-143073@lists.php.net to get a copy of this message
Author: Jorg Sowa (jorgsowa) Date: 2026-10-31T16:17:36+01:00 Commit: https://github.com/php/php-src/commit/7153fabda5188e850cdc9ac954693a9ca0ed38ed Raw diff: https://github.com/php/php-src/commit/7153fabda5188e850cdc9ac954693a9ca0ed38ed.diff Merge branch 'PHP-8.5' into PHP-8.6 Changed paths: A Zend/tests/assert/expect_readonly_anon_class.phpt M NEWS M Zend/zend_ast.c Diff: diff --git a/NEWS b/NEWS index 519a9b22c5f9..591bfbb1f511 100644 --- a/NEWS +++ b/NEWS @@ -15,6 +15,8 @@ PHP NEWS expression cause out-of-bounds write in zp_compile()). (lazerg) . Fixed AST printing dropping final on class constants and properties, and abstract on properties. (Jorg Sowa) + . Fixed AST export of readonly anonymous classes dropping the readonly + modifier. (Jorg Sowa) - CLI: . Fixed bug GH-24697 (PHP_HTTP_PARSER_STRICT build option doesn't work). diff --git a/Zend/tests/assert/expect_readonly_anon_class.phpt b/Zend/tests/assert/expect_readonly_anon_class.phpt new file mode 100644 index 000000000000..5944475ffc4e --- /dev/null +++ b/Zend/tests/assert/expect_readonly_anon_class.phpt @@ -0,0 +1,22 @@ +--TEST-- +AST export of readonly anonymous class +--INI-- +zend.assertions=1 +--FILE-- +<?php +try { + assert(false && new readonly class {}); +} catch (AssertionError $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; +} +try { + assert(false && new #[A] readonly class(1) {}); +} catch (AssertionError $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; +} +?> +--EXPECT-- +AssertionError: assert(false && new readonly class { +}) +AssertionError: assert(false && new #[A] readonly class(1) { +}) diff --git a/Zend/zend_ast.c b/Zend/zend_ast.c index 76ba83395ccd..cae351fe3157 100644 --- a/Zend/zend_ast.c +++ b/Zend/zend_ast.c @@ -2804,6 +2804,9 @@ static ZEND_COLD void zend_ast_export_ex(smart_str *str, zend_ast *ast, int prio if (decl->child[3]) { zend_ast_export_attributes(str, decl->child[3], indent, false); } + if (decl->flags & ZEND_ACC_READONLY_CLASS) { + smart_str_appends(str, "readonly "); + } smart_str_appends(str, "class"); if (!zend_ast_is_list(ast->child[1]) || zend_ast_get_list(ast->child[1])->children) {

« previous php.cvs (#143073) next »