EasyCorp / EasyAdminBundle

EasyAdmin is a fast, beautiful and modern admin generator for Symfony applications.
MIT License
3.99k stars 1.01k forks source link

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

Open pkly opened 2 months ago

pkly commented 2 months ago

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 https://github.com/EasyCorp/EasyAdminBundle/blob/f63e526f65219f26a3add5020a6021a0f5e29e26/src/Field/Configurator/AssociationConfigurator.php#L121

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