10000 [Process] Fixed issue where $env or $_ENV can contain array values by mmucklo · Pull Request #8123 · symfony/symfony · GitHub
[go: up one dir, main page]

Skip to content

[Process] Fixed issue where $env or $_ENV can contain array values #8123

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 11 commits into from
Closed
Next Next commit
Fix Crawler::children() to not trigger a notice for childless node
  • Loading branch information
lazyhammer committed May 16, 2013
commit 91b84903b7924d2295da07dfdea22afb8ffd0d9c
4 changes: 3 additions & 1 deletion src/Symfony/Component/DomCrawler/Crawler.php
Original file line number Diff line number Diff line change
Expand Up @@ -430,7 +430,9 @@ public function children()
throw new \InvalidArgumentException('The current node list is empty.');
}

return new static($this->sibling($this->getNode(0)->firstChild), $this->uri);
$node = $this->getNode(0)->firstChild;

return new static($node ? $this->sibling($node) : array(), $this->uri);
}

/**
Expand Down
8 changes: 8 additions & 0 deletions src/Symfony/Component/DomCrawler/Tests/CrawlerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -536,6 +536,14 @@ public function testChildren()
} catch (\InvalidArgumentException $e) {
$this->assertTrue(true, '->children() throws an \InvalidArgumentException if the node list is empty');
}

try {
$crawler = new Crawler('<p></p>');
$crawler->filter('p')->children();
$this->assertTrue(true, '->children() does not trigger a notice if the node has no children');
} catch (\PHPUnit_Framework_Error_Notice $e) {
$this->fail('->children() does not trigger a notice if the node has no children');
}
}

public function testParents()
Expand Down
0