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

Commit 485efad

Browse filesBrowse files
committed
bug #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 #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 | #8575 (#8575 (comment)) | License | MIT Re-applies 968fe23 (PR #8575). The test for this already exists, it was just this line that got overwritten by eb9f76d#diff-ca5e25b47f3ecc94cd557946aeb486c6L542 To clarify, this is a PR into 2.3 branch - this already exists in 2.4 (and later from this PR: #9146) Commits ------- 8d99d75 [Form][2.3] Fixes empty file-inputs getting treated as extra field.
2 parents 0ccf5bc + 8d99d75 commit 485efad
Copy full SHA for 485efad

File tree

Expand file treeCollapse file tree

2 files changed

+2
-2
lines changed
Filter options
Expand file treeCollapse file tree

2 files changed

+2
-2
lines changed

‎src/Symfony/Component/Form/Form.php

Copy file name to clipboardExpand all lines: src/Symfony/Component/Form/Form.php
+1-1Lines 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

Copy file name to clipboardExpand all lines: src/Symfony/Component/Form/Tests/CompoundFormTest.php
+1-1Lines 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 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.