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

From: Date: Wed, 11 Nov 2026 09:38:49 +0000
Subject: [php-src] master: Merge branch 'PHP-8.4' into PHP-8.5
Groups: php.cvs 
Request: Send a blank email to php-cvs+get-143570@lists.php.net to get a copy of this message
Author: Jorg Sowa (jorgsowa) Date: 2026-11-11T10:31:11+01:00 Commit: https://github.com/php/php-src/commit/24934c98adf640ab8e4f25f5c7acb075f5ccda6b Raw diff: https://github.com/php/php-src/commit/24934c98adf640ab8e4f25f5c7acb075f5ccda6b.diff Merge branch 'PHP-8.4' into PHP-8.5 # Conflicts: # Zend/zend_ast.c Changed paths: A ext/zend_test/tests/compile_to_ast/readonly_promoted.phpt M NEWS M Zend/zend_ast.c Diff: diff --git a/NEWS b/NEWS index c246c61d67e7..03ab890b03c6 100644 --- a/NEWS +++ b/NEWS @@ -21,6 +21,8 @@ PHP NEWS . Fixed use-after-free when the error handler releases a string while an "Illegal string offset" warning is raised for its offset in a read, ?? or nested isset()/empty(). (Jorg Sowa) + . Fixed AST printing dropping readonly on promoted constructor parameters. + (Jorg Sowa) - Curl: . Fixed curl_reset() retaining CURLOPT_PRIVATE after reset. (lacatoire) diff --git a/Zend/zend_ast.c b/Zend/zend_ast.c index e48ec13e98d2..26da17b8a5b2 100644 --- a/Zend/zend_ast.c +++ b/Zend/zend_ast.c @@ -2885,6 +2885,9 @@ static ZEND_COLD void zend_ast_export_ex(smart_str *str, zend_ast *ast, int prio if (ast->attr & ZEND_ACC_FINAL) { smart_str_appends(str, "final "); } + if (ast->attr & ZEND_ACC_READONLY) { + smart_str_appends(str, "readonly "); + } if (ast->child[0]) { zend_ast_export_type(str, ast->child[0], indent); smart_str_appendc(str, ' '); diff --git a/ext/zend_test/tests/compile_to_ast/readonly_promoted.phpt b/ext/zend_test/tests/compile_to_ast/readonly_promoted.phpt new file mode 100644 index 000000000000..c038ce47d21a --- /dev/null +++ b/ext/zend_test/tests/compile_to_ast/readonly_promoted.phpt @@ -0,0 +1,28 @@ +--TEST-- +AST can be recreated (readonly promoted constructor parameters) +--EXTENSIONS-- +zend_test +--FILE-- +<?php + +class Foo { + public function __construct( + public readonly int $publicReadonly, + readonly int $implicitlyPublicReadonly, + protected private(set) readonly array $asymmetricReadonly = [], + #[Attr] private readonly ?string $attributedReadonly = null, + public int $notReadonly = 1, + ) {} +} + +echo zend_test_compile_to_ast( file_get_contents( __FILE__ ) ); + +?> +--EXPECT-- +class Foo { + public function __construct(public readonly int $publicReadonly, readonly int $implicitlyPublicReadonly, protected private(set) readonly array $asymmetricReadonly = [], #[Attr] private readonly ?string $attributedReadonly = null, public int $notReadonly = 1) { + } + +} + +echo zend_test_compile_to_ast(file_get_contents(__FILE__));

« previous php.cvs (#143570) next »