Closed
Description
Q | A |
---|---|
Bug report? | yes |
Feature request? | no |
BC Break report? | no |
RFC? | no |
Symfony version | 2.8.11 |
Hello.
Is it ok, when incorrect data submitted to ChoiceType and isValid
returns true
?
$form = $this->factory->create('Symfony\Component\Form\Extension\Core\Type\ChoiceType', null, array(
'expanded' => true
'choices' => [
'a' => 'a',
'b' => 'b'
],
));
$form->submit('c');
$form->isValid(); // returns true
$form->isSynchronized(); // returns false
$form->getData(); // returns null
It actually strange that this submission is valid.
It happens because ChoiceType throws TransformationFailedException on PRE_SUBMIT event.
I think in this case isValid
should return false
.
What do you think?