Skip to content

[Form] [Validator] Form with ArrayAccess and field with property_path=>[key] broken #37125

Closed
@lucagtc

Description

@lucagtc

Symfony version(s) affected: 4.4

Description
When form with object $data type ArrayAccess (example Doctrine ArrayCollection) is validate and the field use 'property_path' => '[key]', is generated wrong validation path -> [[key]].

How to reproduce
Create a form with data type ArrayCollection and add field with property_path => '[key]'. Then insert wrong value and validate.

Here a piece of wrong code (in my opinion)

$fieldPropertyPath = \is_object($data) ? 'children[%s]' : 'children%s';

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions