[php-src] master: Merge branch 'PHP-8.5' into PHP-8.6
| From: | Jorg Sowa | Date: | Thu, 12 Nov 2026 12:54:10 +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-143630@lists.php.net to get a copy of this message | ||
Author: Jorg Sowa (jorgsowa)
Date: 2026-11-12T13:27:18+01:00
Commit: https://github.com/php/php-src/commit/e1139954df1866856ef38b0b51d71f46a5f5ab2c
Raw diff: https://github.com/php/php-src/commit/e1139954df1866856ef38b0b51d71f46a5f5ab2c.diff
Merge branch 'PHP-8.5' into PHP-8.6
Changed paths:
A Zend/tests/property_hooks/ast_printing_by_ref.phpt
M NEWS
M Zend/zend_ast.c
Diff:
diff --git a/NEWS b/NEWS
index 567e9baf8218..92cf423f60af 100644
--- a/NEWS
+++ b/NEWS
@@ -33,6 +33,7 @@ PHP NEWS
(Jorg Sowa)
. Fixed bug GH-25311 (Assertion ret == SUCCESS in array_map()/array_filter()
after delayed out-of-memory). (ndossche)
+ . Fixed AST export of by-reference property hooks. (Jorg Sowa)
- Curl:
. Fixed curl_reset() retaining CURLOPT_PRIVATE after reset. (lacatoire)
diff --git a/Zend/tests/property_hooks/ast_printing_by_ref.phpt
b/Zend/tests/property_hooks/ast_printing_by_ref.phpt
new file mode 100644
index 000000000000..a3b0bd405f74
--- /dev/null
+++ b/Zend/tests/property_hooks/ast_printing_by_ref.phpt
@@ -0,0 +1,34 @@
+--TEST--
+By-reference hook AST printing
+--FILE--
+<?php
+
+try {
+ assert(false && new class {
+ public $prop1 { &get => $this->prop1; }
+ public $prop2 {
+ final &get {
+ return $this->prop2;
+ }
+ }
+ public private(set) int $prop3 { &get => $this->prop3; }
+ });
+} catch (Error $e) {
+ echo $e->getMessage(), "\n";
+}
+
+?>
+--EXPECT--
+assert(false && new class {
+ public $prop1 {
+ &get => $this->prop1;
+ }
+ public $prop2 {
+ final &get {
+ return $this->prop2;
+ }
+ }
+ public private(set) int $prop3 {
+ &get => $this->prop3;
+ }
+})
diff --git a/Zend/zend_ast.c b/Zend/zend_ast.c
index eea1ae07888b..1fb4b8a28e40 100644
--- a/Zend/zend_ast.c
+++ b/Zend/zend_ast.c
@@ -2255,10 +2255,12 @@ 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];
- zend_ast_export_visibility(str, hook->flags, ZEND_MODIFIER_TARGET_PROPERTY);
if (hook->flags & ZEND_ACC_FINAL) {
smart_str_appends(str, "final ");
}
+ if (hook->flags & ZEND_ACC_RETURN_REFERENCE) {
+ smart_str_appendc(str, '&');
+ }
smart_str_append(str, hook->name);
zend_ast *body = hook->child[2];
if (body == NULL) {