diff --git a/src/Symfony/Component/Form/Form.php b/src/Symfony/Component/Form/Form.php index d7109bd3ac3eb..7c94fe395f96f 100644 --- a/src/Symfony/Component/Form/Form.php +++ b/src/Symfony/Component/Form/Form.php @@ -758,7 +758,7 @@ public function isEmpty() */ public function isValid() { - if (!$this->submitted) { + if (!$this->submitted || $this->transformationFailure) { return false; } diff --git a/src/Symfony/Component/Form/Tests/Extension/Core/Type/ChoiceTypeTest.php b/src/Symfony/Component/Form/Tests/Extension/Core/Type/ChoiceTypeTest.php index b675d5d6eee08..f7e8484fd840f 100644 --- a/src/Symfony/Component/Form/Tests/Extension/Core/Type/ChoiceTypeTest.php +++ b/src/Symfony/Component/Form/Tests/Extension/Core/Type/ChoiceTypeTest.php @@ -524,6 +524,7 @@ public function testSubmitSingleNonExpandedInvalidChoice() $this->assertNull($form->getData()); $this->assertEquals('foobar', $form->getViewData()); + $this->assertFalse($form->isValid()); $this->assertFalse($form->isSynchronized()); } @@ -945,6 +946,7 @@ public function testSubmitSingleExpandedRequiredInvalidChoice() $this->assertNull($form->getData()); $this->assertSame('foobar', $form->getViewData()); $this->assertEmpty($form->getExtraData()); + $this->assertFalse($form->isValid()); $this->assertFalse($form->isSynchronized()); $this->assertFalse($form[0]->getData());