Skip to content

[Form] ContextErrorException in FileType #25063

Closed
@chihiro-adachi

Description

@chihiro-adachi
Q A
Bug report? yes
Feature request? no
BC Break report? no
RFC? no
Symfony version 2.7.38, 3.3.13

In symfony 2.7.38 / 3.3.13, the following warning occurred with FileType.

ContextErrorException in FileType.php line 43:
Warning: Invalid argument supplied for foreach()

It is reproduced with the following code. (I am using Silex)

        $builder = $app['form.factory']->createBuilder();
        $builder->add('file', FileType::class, [
            'multiple' => true,
        ]);

        $form->submit([]);

$event->getData() returns null, so it appears to be warned by foreach ().

https://github.com/symfony/symfony/blob/master/src/Symfony/Component/Form/Extension/Core/Type/FileType.php#L38

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