Skip to content

Commit 485efad

Browse files
committed
bug symfony#10251 [Form][2.3] Fixes empty file-inputs getting treated as extra field. (jenkoian)
This PR was squashed before being merged into the 2.3 branch (closes symfony#10251). Discussion ---------- [Form][2.3] Fixes empty file-inputs getting treated as extra field. | Q | A | ------------- | --- | Bug fix? | yes | New feature? | no | BC breaks? | no | Deprecations? | no | Tests pass? | yes | Fixed tickets | symfony#8575 (symfony#8575 (comment)) | License | MIT Re-applies 968fe23 (PR symfony#8575). The test for this already exists, it was just this line that got overwritten by symfony@eb9f76d#diff-ca5e25b47f3ecc94cd557946aeb486c6L542 To clarify, this is a PR into 2.3 branch - this already exists in 2.4 (and later from this PR: symfony#9146) Commits ------- 8d99d75 [Form][2.3] Fixes empty file-inputs getting treated as extra field.
2 parents 0ccf5bc + 8d99d75 commit 485efad

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

src/Symfony/Component/Form/Form.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -556,7 +556,7 @@ public function submit($submittedData, $clearMissing = true)
556556
}
557557

558558
foreach ($this->children as $name => $child) {
559-
if (isset($submittedData[$name]) || $clearMissing) {
559+
if (array_key_exists($name, $submittedData) || $clearMissing) {
560560
$child->submit(isset($submittedData[$name]) ? $submittedData[$name] : null, $clearMissing);
561561
unset($submittedData[$name]);
562562

src/Symfony/Component/Form/Tests/CompoundFormTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,7 @@ public function testSubmitDoesNotAddExtraFieldForNullValues()
115115
$child = $factory->create('file', null, array('auto_initialize' => false));
116116

117117
$this->form->add($child);
118-
$this->form->submit(array('file' => null));
118+
$this->form->submit(array('file' => null), false);
119119

120120
$this->assertCount(0, $this->form->getExtraData());
121121
}

0 commit comments

Comments
 (0)