diff --git a/src/Symfony/Component/DomCrawler/Form.php b/src/Symfony/Component/DomCrawler/Form.php index 0a86c7e6d406..8a6e28ca86c3 100644 --- a/src/Symfony/Component/DomCrawler/Form.php +++ b/src/Symfony/Component/DomCrawler/Form.php @@ -89,6 +89,10 @@ public function getValues() { $values = []; foreach ($this->fields->all() as $name => $field) { + if ($field->isDisabled()) { + continue; + } + if (!$field instanceof Field\FileFormField && $field->hasValue()) { $values[$name] = $field->getValue(); } @@ -111,6 +115,10 @@ public function getFiles() $files = []; foreach ($this->fields->all() as $name => $field) { + if ($field->isDisabled()) { + continue; + } + if ($field instanceof Field\FileFormField) { $files[$name] = $field->getValue(); } @@ -455,7 +463,7 @@ private function initialize() private function addField(\DOMElement $node) { - if (!$node->hasAttribute('name') || !$node->getAttribute('name') || $node->hasAttribute('disabled')) { + if (!$node->hasAttribute('name') || !$node->getAttribute('name')) { return; } diff --git a/src/Symfony/Component/DomCrawler/Tests/FormTest.php b/src/Symfony/Component/DomCrawler/Tests/FormTest.php index 9894eb429a9e..f042513f8d68 100644 --- a/src/Symfony/Component/DomCrawler/Tests/FormTest.php +++ b/src/Symfony/Component/DomCrawler/Tests/FormTest.php @@ -159,12 +159,12 @@ public function testConstructorHandlesFormValues() public function testMultiValuedFields() { $form = $this->createForm('
- - - - - - + + + + + +
'); @@ -227,10 +227,10 @@ public function provideInitializeValues() [], ], [ - 'skips disabled input fields', + 'takes into account disabled input fields', ' ', - [], + ['foo' => ['InputFormField', 'foo']], ], [ 'appends the submitted button value',