Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 8d80108

Browse files
committed
Retrieve the current node outside of the loop
1 parent 58647b8 commit 8d80108

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

src/Symfony/Component/DomCrawler/Crawler.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -963,8 +963,9 @@ protected function sibling($node, $siblingDir = 'nextSibling')
963963
{
964964
$nodes = array();
965965

966+
$currentNode = $this->getNode(0);
966967
do {
967-
if (1 === $node->nodeType && $node !== $this->getNode(0)) {
968+
if ($node !== $currentNode && 1 === $node->nodeType) {
968969
$nodes[] = $node;
969970
}
970971
} while ($node = $node->$siblingDir);

0 commit comments

Comments
 (0)