Skip to content

Commit 8a09b53

Browse files
committed
Merge branch 'PHP-8.6'
# Conflicts: # NEWS
2 parents 93cb276 + e113995 commit 8a09b53

2 files changed

Lines changed: 37 additions & 1 deletion

File tree

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
--TEST--
2+
By-reference hook AST printing
3+
--FILE--
4+
<?php
5+
6+
try {
7+
assert(false && new class {
8+
public $prop1 { &get => $this->prop1; }
9+
public $prop2 {
10+
final &get {
11+
return $this->prop2;
12+
}
13+
}
14+
public private(set) int $prop3 { &get => $this->prop3; }
15+
});
16+
} catch (Error $e) {
17+
echo $e->getMessage(), "\n";
18+
}
19+
20+
?>
21+
--EXPECT--
22+
assert(false && new class {
23+
public $prop1 {
24+
&get => $this->prop1;
25+
}
26+
public $prop2 {
27+
final &get {
28+
return $this->prop2;
29+
}
30+
}
31+
public private(set) int $prop3 {
32+
&get => $this->prop3;
33+
}
34+
})

‎Zend/zend_ast.c‎

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2256,10 +2256,12 @@ static ZEND_COLD void zend_ast_export_hook_list(smart_str *str, const zend_ast_l
22562256

22572257
for (uint32_t i = 0; i < hook_list->children; i++) {
22582258
const zend_ast_decl *hook = (const zend_ast_decl *)hook_list->child[i];
2259-
zend_ast_export_visibility(str, hook->flags, ZEND_MODIFIER_TARGET_PROPERTY);
22602259
if (hook->flags & ZEND_ACC_FINAL) {
22612260
smart_str_appends(str, "final ");
22622261
}
2262+
if (hook->flags & ZEND_ACC_RETURN_REFERENCE) {
2263+
smart_str_appendc(str, '&');
2264+
}
22632265
smart_str_append(str, hook->name);
22642266
zend_ast *body = hook->child[2];
22652267
if (body == NULL) {

0 commit comments

Comments
 (0)