8000 [Form] Fixed invalid state of non synchronized forms by HeahDude · Pull Request #20966 · symfony/symfony · GitHub
[go: up one dir, main page]

Skip to content

[Form] Fixed invalid state of non synchronized forms #20966

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/Symfony/Component/Form/Form.php
Original file line number Diff line number Diff line change
Expand Up @@ -758,7 +758,7 @@ public function isEmpty()
*/
public function isValid()
{
if (!$this->submitted) {
if (!$this->submitted || $this->transformationFailure) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

- if (!$this->submitted || $this->transformationFailure) {
+ if (!$this->submitted || !$this->isSynchronized()) {

?

Copy link
Contributor Author
8000

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Performance wise, this function call is useless IMO.

return false;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -524,6 +524,7 @@ public function testSubmitSingleNonExpandedInvalidChoice()

$this->assertNull($form->getData());
$this->assertEquals('foobar', $form->getViewData());
$this->assertFalse($form->isValid());
$this->assertFalse($form->isSynchronized());
}

Expand Down Expand Up @@ -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());
Expand Down
0