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

Open
pkly opened this issue Mar 20, 2024 · 0 comments · May be fixed by #6212
Open

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

pkly opened this issue Mar 20, 2024 · 0 comments · May be fixed by #6212

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.

@pkly pkly linked a pull request Mar 20, 2024 that will close this issue
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 a pull request may close this issue.

1 participant