Skip to content

[Form] ChoiceType error after upgrade to 3.0.4 #18461

@walczakmac

Description

@walczakmac

I just upgraded to Symfony 3.0.4 and I can't set integers as choice values in ChoiceType field. Validation gives me "This value is not valid." message for an integer value. In my case it was default value passed through "empty_data" option.

Here is example field I use to reproduce this:

$builder->add('emailNotificationsEnabled', ChoiceType::class, [
    'required' => false,
    'multiple' => false,
    'choices'  => [0, 1],
    'empty_data' => 1,
]);

I found out that this is caused by this change: 3eac469#diff-81585954baecb0c458557b7969974093L42

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions