diff options
author | Andres Rey <[email protected]> | 2016-12-10 19:04:23 +0000 |
---|---|---|
committer | Andres Rey <[email protected]> | 2016-12-10 19:04:23 +0000 |
commit | c7351d93ef2828e88aad20d44051a16fedf6a339 (patch) | |
tree | 5e97e8daf27d1ad9d4ad0b156215f5d4234933c2 /src | |
parent | 3464e0409dfda479e00957a5b684389d949fb27a (diff) |
Fixed wrong iteration on hasSingleChildBlockElement. Funny how one single line in JS turns into 10 in PHP. Not because PHP, more like because I'm a sub par dev :F
Diffstat (limited to 'src')
-rw-r--r-- | src/HTMLParser.php | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/src/HTMLParser.php b/src/HTMLParser.php index 92a85a4..5b2aa2f 100644 --- a/src/HTMLParser.php +++ b/src/HTMLParser.php @@ -889,17 +889,19 @@ class HTMLParser private function hasSingleChildBlockElement(Readability $node) { + $result = false; if ($node->hasChildren()) { /** @var Readability $child */ foreach ($node->getChildren() as $child) { if (in_array($child->getTagName(), $this->divToPElements)) { - return true; + $result = true; } else { - return $this->hasSingleChildBlockElement($child); + // If any of the hasSingleChildBlockElement calls return true, return true then. + $result = ($result || $this->hasSingleChildBlockElement($child)); } } } - return true; + return $result; } } |