Skip to content

zend_ast: Fix AST export of by-reference property hooks - #25069

Closed
jorgsowa wants to merge 1 commit into
php:PHP-8.4from
jorgsowa:fix-hook-by-ref-ast-export
Closed

jorgsowa wants to merge 1 commit into
php:PHP-8.4from
jorgsowa:fix-hook-by-ref-ast-export

Conversation

@jorgsowa

Copy link
Copy Markdown
Contributor

ZEND_ACC_RETURN_REFERENCE shares a bit with ZEND_ACC_PRIVATE_SET, so &get was exported as private(set) get.

@jorgsowa jorgsowa self-assigned this Oct 30, 2026
Comment thread Zend/zend_ast.c

for (uint32_t i = 0; i < hook_list->children; i++) {
zend_ast_decl *hook = (zend_ast_decl *)hook_list->child[i];
zend_ast_export_visibility(str, hook->flags, ZEND_MODIFIER_TARGET_PROPERTY);

@jorgsowa jorgsowa Oct 30, 2026 •

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Property hooks cannot declare visibility in source

ZEND_ACC_RETURN_REFERENCE shares a bit with ZEND_ACC_PRIVATE_SET, so &get
was exported as private(set) get.
@jorgsowa
jorgsowa force-pushed the fix-hook-by-ref-ast-export branch from 2331052 to 6827e8d Compare November 11, 2026 15:49
@jorgsowa
jorgsowa requested a review from iliaal November 12, 2026 11:25

@iliaal iliaal left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. Hooks also lose their parameter list and attributes on export (set(int $v) => $v prints as set => $v), could be folded in here or done separately.

@jorgsowa

Copy link
Copy Markdown
Contributor Author

Thanks. I will take care in next PRs.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants