Skip to content

[Form] Form parent can't be accessed if form has a child named "parent" in Twig. #28686

@moynzzz

Description

@moynzzz

Symfony version(s) affected: All

Description
If you have a form that has a child named parent there is no possible way to access the parent variable in Twig.

How to reproduce
Create a simple form and have a child named parent. Then try in the twig template to access the actual form parent. The form.parent returns the child.

The problem with this issue is that it is related to how twig accesses properties of an object not specifically to the form component because in PHP there will be no problem to access the parent form or the child named parent. Should I open an issue in the twig repository instead?

Note that this works the same with all other FormView's properties vars and children.

I found this bug when I tried to fix this issue EasyCorp/EasyAdminBundle#2228 and more specific information can be found there.

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

      pFad - Phonifier reborn

      Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

      Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


      Alternative Proxies:

      Alternative Proxy

      pFad Proxy

      pFad v3 Proxy

      pFad v4 Proxy