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

ChoiceType with int values broken #21952

Copy link
Copy link
Closed
@mcfedr

Description

@mcfedr
Issue body actions
Q A
Bug report? yes
Feature request? no
BC Break report? yes
RFC? no
Symfony version 3.2.5

I am using Forms to validate incoming data, and have ChoiceTypes that receive int.

#21267 introduces a change that requires all values to strings. Clearly this breaks stuff.

Example:

->add('days', ChoiceType::class, [
    'choices' => [
        'Mon' => 1,
        'Tue' => 2,
        'Wed' => 3,
        'Thu' => 4,
        'Fri' => 5,
        'Sat' => 6,
        'Sun' => 7,
    ],
    'preferred_choices' => [(int) date('w')],
    'multiple' => true,
    'by_reference' => false,
])

And the submitted data is:

'days' => [1, 2, 3, 4, 5, 6, 0],

I am using forms to handle data coming in as json, using mcfedr/json-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.