-
-
Notifications
You must be signed in to change notification settings - Fork 9.6k
[VarExporter] Fix: Use correct closure call for property-specific logic in $notByRef #60258
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good catch, my bad.
Do you think you could add a test case to cover this?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please account for stof's comment. The fix is good.
I added a new test case for property hooks with a default value. Therefore, I had to move the added property from the Hooked class to a separate HookedWithDefaultValue class, because otherwise the existing test case would have failed too. |
Thank you @Hakayashii. |
…sent (xabbuh) This PR was merged into the 6.4 branch. Discussion ---------- [VarExporter] dump default value for property hooks if present | Q | A | ------------- | --- | Branch? | 6.4 | Bug fix? | yes | New feature? | no | Deprecations? | no | Issues | | License | MIT The test added in #60258 reveals that we have another bug in our lazy ghost generation logic which leads to an error at runtime when a hook tries to read the property's default value. Commits ------- e819dab dump default value for property hooks if present
Previously, $notByRef was treated as a callable instead of an array of closures. Now, the closure is correctly invoked with $notByRef[$name]($object, $value) if it's not true.
Encountered the following error after loading an entity from the database using Doctrine, which held a reference to another entity. The error occurred when modifying this lazily-loaded reference.