Skip to content
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

RenderFilters crashes when EntityDto->Instance is not set on Symfony 6.4 #6211

Closed
pkly opened this issue Mar 20, 2024 · 0 comments · Fixed by #6212
Closed

RenderFilters crashes when EntityDto->Instance is not set on Symfony 6.4 #6211

pkly opened this issue Mar 20, 2024 · 0 comments · Fixed by #6212
Labels
Milestone

Comments

@pkly
Copy link
Contributor

pkly commented Mar 20, 2024

Describe the bug
A crash from PropertyAccessor via AssociationConfigurator

To Reproduce
Unsure exactly, but it appears that when a null instance is passed to EntityDto and RenderFilters is called, AssociationConfigurator will always attempt accessing the value from EntityDto, however as PropertyAccessor in symfony 6.4 uses a hard object|array typing this will then cause a TypeError which isn't caught by AssociationConfigurator (only catches UnexpectedTypeException)

(OPTIONAL) Additional context

$relatedEntityId = $accessor->getValue($entityDto->getInstance(), $propertyName.'.'.$metadata->getIdentifierFieldNames()[0]);

This line should be preceded by a if(null !== $entityDto->getInstance()) check to prevent the crash, I'll make a fork shortly.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants