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

NumberToLocalizedStringTransformer incorrect reverseTransform #28500

Copy link
Copy link
Closed
@koutja

Description

@koutja
Issue body actions

Symfony version(s) affected: 3.4.15
PHP 7.2

Description

Unable to reverse value for property path "foo": The number contains unrecognized characters: "."
when valeu equal '239.' or other string contains number with dot in end.
It was happend in class Symfony\Component\Form\Extension\Core\DataTransformer\NumberToLocalizedStringTransformer when call method reverseTransform

How to reproduce

  1. Create form like this
    public function buildForm(FormBuilderInterface $builder, array $options)
    {
        $builder->add('foo', NumberType::class, ['required' => false]);
    }
  1. submit values and check valid
$form->submit([
    'foo' => '239.'
]);
if (!$form->isValid()){
    echo 'form is not valid';
}

OR

$transformer = NumberToLocalizedStringTransformer();
$transformer->reverseTransform('239.');

Possible Solution

Additional context

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.