10000 merged branch bierdok/master (PR #6015) · symfony/symfony@c34f773 · GitHub
[go: up one dir, main page]

Skip to content

Commit c34f773

Browse files
committed
merged branch bierdok/master (PR #6015)
This PR was submitted for the master branch but it was merged into the 2.0 branch instead (closes #6015). Commits ------- f61c019 Update src/Symfony/Component/DomCrawler/Tests/FormTest.php 9b3aaf2 Update src/Symfony/Component/DomCrawler/Form.php Discussion ---------- FIX: Malformed field path "" In case we have the name attribute empty. --------------------------------------------------------------------------- by fabpot at 2012-11-15T06:12:35Z Can you add a unit test for that case? --------------------------------------------------------------------------- by bierdok at 2012-11-15T09:21:01Z Voila.
2 parents cb00411 + e7401a2 commit c34f773

File tree

2 files changed

+7
-1
lines changed

2 files changed

+7
-1
lines changed

src/Symfony/Component/DomCrawler/Form.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -294,7 +294,7 @@ private function initialize()
294294
$xpath = new \DOMXPath($document);
295295

296296
foreach ($xpath->query('descendant::input | descendant::button | descendant::textarea | descendant::select', $root) as $node) {
297-
if (!$node->hasAttribute('name')) {
297+
if (!$node->hasAttribute('name') || !$node->getAttribute('name')) {
298298
continue;
299299
}
300300

tests/Symfony/Tests/Component/DomCrawler/FormTest.php

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,12 @@ public function provideInitializeValues()
7272
<input type="submit" />',
7373
array(),
7474
),
75+
array(
76+
'does not take into account input fields with an empty name attribute value',
77+
'<input type="text" name="" value="foo" />
78+
<input type="submit" />',
79+
array(),
80+
),
7581
array(
7682
'takes into account disabled input fields',
7783
'<input type="text" name="foo" value="foo" disabled="disabled" />

0 commit comments

Comments
 (0)
0