Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

[Form] Empty root form name fails with PUT method #19017

Copy link
Copy link
Closed
@jbenezech

Description

@jbenezech
Issue body actions

A form created like this will result in an extra data error

        $form = $this->get('form.factory')  
            ->createNamed('',  
            ArticleType::class,  
            $article,  
            [  
                'action' => $this->generateUrl(  
                    'article_update',  
                    [  
                        'article' => $article->getId()  
                    ]  
                ),  
                'method' => 'PUT',  
            ]  
        );  

It seems that the RequestHandler will submit the form with all request parameters in case of an empty form name (which includes the hidden _method field)

if ('' === $name) {
    $params = $request->request->all();
    $files = $request->files->all();
}

The submit method of the Form doesn't seem to do any particular check for that special parameter.

A workaround is to set allow_extra_fields to true in the form

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

      Morty Proxy This is a proxified and sanitized view of the page, visit original site.