Skip to content

Document that readonly properties cannot be initialized by reference - #5226

Merged
lacatoire merged 1 commit into
php:masterfrom
lacatoire:fix/issue-3250-readonly-reference-init
Aug 28, 2026
Merged

Document that readonly properties cannot be initialized by reference#5226
lacatoire merged 1 commit into
php:masterfrom
lacatoire:fix/issue-3250-readonly-reference-init

Conversation

@lacatoire

@lacatoire lacatoire commented Jan 30, 2026

Copy link
Copy Markdown
Member

Clarify that an uninitialized readonly property must be initialized by a direct assignment, and cannot be initialized by reference, neither by being passed to a parameter that expects to be passed by reference nor by reference assignment.

Fixes #3250

@lacatoire
lacatoire force-pushed the fix/issue-3250-readonly-reference-init branch from f4149c2 to 68a6d0e Compare January 30, 2026 10:36
@lacatoire lacatoire closed this Mar 2, 2026
@lacatoire lacatoire reopened this Aug 21, 2026
@lacatoire
lacatoire force-pushed the fix/issue-3250-readonly-reference-init branch from 68a6d0e to 1e72b6a Compare August 21, 2026 09:59
@lacatoire
lacatoire force-pushed the fix/issue-3250-readonly-reference-init branch from 1e72b6a to dc1dfc8 Compare August 28, 2026 13:17
Clarify that readonly properties must be initialized through direct
assignment and cannot be initialized via by-reference parameters.

Fixes php#3250
@lacatoire
lacatoire force-pushed the fix/issue-3250-readonly-reference-init branch from dc1dfc8 to 0b42c0f Compare August 28, 2026 15:00
@lacatoire
lacatoire merged commit 4e77868 into php:master Aug 28, 2026
2 checks passed
@lacatoire
lacatoire deleted the fix/issue-3250-readonly-reference-init branch August 28, 2026 15:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Initialisation of readonly properties by reference does not work (e.g. matches of preg_match)

1 participant