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

From: Date: Thu, 12 Nov 2026 15:10:45 +0000
Subject: [php-src] master: Merge branch 'PHP-8.6'
Groups: php.cvs 
Request: Send a blank email to php-cvs+get-143642@lists.php.net to get a copy of this message
Author: Jorg Sowa (jorgsowa) Date: 2026-11-12T15:46:00+01:00 Commit: https://github.com/php/php-src/commit/cb06eb256e9939d6e9072d5dfd6c73a97239fa94 Raw diff: https://github.com/php/php-src/commit/cb06eb256e9939d6e9072d5dfd6c73a97239fa94.diff Merge branch 'PHP-8.6' # Conflicts: # NEWS Changed paths: A Zend/tests/property_hooks/ast_printing_params_attributes.phpt M Zend/zend_ast.c Diff: diff --git a/Zend/tests/property_hooks/ast_printing_params_attributes.phpt b/Zend/tests/property_hooks/ast_printing_params_attributes.phpt new file mode 100644 index 000000000000..b5277c8c0a9c --- /dev/null +++ b/Zend/tests/property_hooks/ast_printing_params_attributes.phpt @@ -0,0 +1,65 @@ +--TEST-- +Hook parameter list and attributes AST printing +--FILE-- +<?php + +try { + assert(false && new class { + public int $prop1 { + set(int $value) => $value * 2; + } + public $prop2 { + #[A] + get => $this->prop2; + #[A(1), B] + #[C] + final set($value) { + $this->prop2 = $value; + } + } + public string $prop3 { + set(#[SensitiveParameter] string|int $value) => (string) $value; + } + public $prop4 { + #[A] final &get => $this->prop4; + } + public function __construct( + public int $prop5 { + #[A] + set(int $value) => $value + 1; + }, + ) {} + }); +} catch (Error $e) { + echo $e->getMessage(), "\n"; +} + +?> +--EXPECT-- +assert(false && new class { + public int $prop1 { + set(int $value) => $value * 2; + } + public $prop2 { + #[A] + get => $this->prop2; + #[A(1), B] + #[C] + final set($value) { + $this->prop2 = $value; + } + } + public string $prop3 { + set(#[SensitiveParameter] string|int $value) => (string)$value; + } + public $prop4 { + #[A] + final &get => $this->prop4; + } + public function __construct(public int $prop5 { + #[A] + set(int $value) => $value + 1; + }) { + } + +}) diff --git a/Zend/zend_ast.c b/Zend/zend_ast.c index 501b8c92f573..9ef1cf3b6788 100644 --- a/Zend/zend_ast.c +++ b/Zend/zend_ast.c @@ -2256,6 +2256,9 @@ static ZEND_COLD void zend_ast_export_hook_list(smart_str *str, const zend_ast_l for (uint32_t i = 0; i < hook_list->children; i++) { const zend_ast_decl *hook = (const zend_ast_decl *)hook_list->child[i]; + if (hook->child[4]) { + zend_ast_export_attributes(str, hook->child[4], indent, 1); + } if (hook->flags & ZEND_ACC_FINAL) { smart_str_appends(str, "final "); } @@ -2263,6 +2266,11 @@ static ZEND_COLD void zend_ast_export_hook_list(smart_str *str, const zend_ast_l smart_str_appendc(str, '&'); } smart_str_append(str, hook->name); + if (hook->child[0]) { + smart_str_appendc(str, '('); + zend_ast_export_ex(str, hook->child[0], 0, indent); + smart_str_appendc(str, ')'); + } zend_ast *body = hook->child[2]; if (body == NULL) { smart_str_appendc(str, ';');

« previous php.cvs (#143642) next »