Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

[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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged
fabpot merged 1 commit intosymfony:6.4fromHakayashii:patch-2
Apr 27, 2025

Conversation

Hakayashii
Copy link
Contributor

@HakayashiiHakayashii commentedApr 23, 2025
edited by OskarStark
Loading

QA
Branch?6.4
Bug fix?yes
New feature?no
Deprecations?no
IssuesFix #...
LicenseMIT

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.

[critical] Uncaught Error: Array callback must have exactly two elementsIn Hydrator.php line 163:                                                   [Error]                                          Array callback must have exactly two elements    Exception trace:  at C:\Users\hakayashii\repos\test\vendor\symfony\var-exporter\Internal\Hydrator.php:163 Proxies\__CG__\App\Entity\Subscription->{closure:Symfony\Component\VarExporter\Internal\Hydrator::getSimpleHydrator():155}() at C:\Users\hakayashii\repos\test\vendor\symfony\var-exporter\Hydrator.php:72 Symfony\Component\VarExporter\Hydrator::hydrate() at C:\Users\hakayashii\repos\test\vendor\symfony\var-exporter\Internal\LazyObjectState.php:56 Symfony\Component\VarExporter\Internal\LazyObjectState->initialize() at C:\Users\hakayashii\repos\test\vendor\symfony\var-exporter\LazyGhostTrait.php:146 Proxies\__CG__\App\Entity\Subscription->__get() at C:\Users\hakayashii\repos\test\src\Service\OrderBuilder.php:45[...]

Copy link
Member

@nicolas-grekasnicolas-grekas left a 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?

@symfonysymfony deleted a comment fromcarsonbotApr 23, 2025
@symfonysymfony deleted a comment fromcarsonbotApr 23, 2025
@carsonbotcarsonbot changed the titleFix: Use correct closure call for property-specific logic in $notByRef[VarExporter] Fix: Use correct closure call for property-specific logic in $notByRefApr 24, 2025
Copy link
Member

@nicolas-grekasnicolas-grekas left a 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.

@Hakayashii
Copy link
ContributorAuthor

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.

@fabpot
Copy link
Member

Thank you@Hakayashii.

@fabpotfabpot merged commitc5d39dd intosymfony:6.4Apr 27, 2025
1 check passed
fabpot added a commit that referenced this pull requestMay 2, 2025
…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       | MITThe 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
This was referencedMay 2, 2025
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment
Reviewers

@stofstofstof left review comments

@ging-devging-devging-dev left review comments

@nicolas-grekasnicolas-grekasnicolas-grekas approved these changes

@xabbuhxabbuhxabbuh approved these changes

Assignees
No one assigned
Projects
None yet
Milestone
6.4
Development

Successfully merging this pull request may close these issues.

7 participants
@Hakayashii@fabpot@nicolas-grekas@stof@xabbuh@ging-dev@carsonbot

[8]ページ先頭

©2009-2025 Movatter.jp