Skip to content

Commit 75273fa

Browse files
Merge branch '3.4' into 4.4
* 3.4: [Phpunit] Fix running skipped tests expecting only deprecations [DependencyInjection] #35505 Fix typo in test name [Yaml][Inline] Fail properly on empty object tag and empty const tag Check non-null type for numeric type Check value isset to avoid PHP notice bug symfony#28179 [DomCrawler] Skip disabled fields processing in Form
2 parents b66fe8c + 8540917 commit 75273fa

File tree

2 files changed

+9
-17
lines changed

2 files changed

+9
-17
lines changed

Form.php

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -89,10 +89,6 @@ public function getValues()
8989
{
9090
$values = [];
9191
foreach ($this->fields->all() as $name => $field) {
92-
if ($field->isDisabled()) {
93-
continue;
94-
}
95-
9692
if (!$field instanceof Field\FileFormField && $field->hasValue()) {
9793
$values[$name] = $field->getValue();
9894
}
@@ -115,10 +111,6 @@ public function getFiles()
115111
$files = [];
116112

117113
foreach ($this->fields->all() as $name => $field) {
118-
if ($field->isDisabled()) {
119-
continue;
120-
}
121-
122114
if ($field instanceof Field\FileFormField) {
123115
$files[$name] = $field->getValue();
124116
}
@@ -473,7 +465,7 @@ private function initialize()
473465

474466
private function addField(\DOMElement $node)
475467
{
476-
if (!$node->hasAttribute('name') || !$node->getAttribute('name')) {
468+
if (!$node->hasAttribute('name') || !$node->getAttribute('name') || $node->hasAttribute('disabled')) {
477469
return;
478470
}
479471

Tests/FormTest.php

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -158,12 +158,12 @@ public function testConstructorHandlesFormValues()
158158
public function testMultiValuedFields()
159159
{
160160
$form = $this->createForm('<form>
161-
<input type="text" name="foo[4]" value="foo" disabled="disabled" />
162-
<input type="text" name="foo" value="foo" disabled="disabled" />
163-
<input type="text" name="foo[2]" value="foo" disabled="disabled" />
164-
<input type="text" name="foo[]" value="foo" disabled="disabled" />
165-
<input type="text" name="bar[foo][]" value="foo" disabled="disabled" />
166-
<input type="text" name="bar[foo][foobar]" value="foo" disabled="disabled" />
161+
<input type="text" name="foo[4]" value="foo" />
162+
<input type="text" name="foo" value="foo" />
163+
<input type="text" name="foo[2]" value="foo" />
164+
<input type="text" name="foo[]" value="foo" />
165+
<input type="text" name="bar[foo][]" value="foo" />
166+
<input type="text" name="bar[foo][foobar]" value="foo" />
167167
<input type="submit" />
168168
</form>
169169
');
@@ -226,10 +226,10 @@ public function provideInitializeValues()
226226
[],
227227
],
228228
[
229-
'takes into account disabled input fields',
229+
'skips disabled input fields',
230230
'<input type="text" name="foo" value="foo" disabled="disabled" />
231231
<input type="submit" />',
232-
['foo' => ['InputFormField', 'foo']],
232+
[],
233233
],
234234
[
235235
'appends the submitted button value',

0 commit comments

Comments
 (0)