diff options
Diffstat (limited to 'src/Readability.php')
-rw-r--r-- | src/Readability.php | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/src/Readability.php b/src/Readability.php index f22c1e2..7ff302f 100644 --- a/src/Readability.php +++ b/src/Readability.php @@ -898,7 +898,8 @@ class Readability $scoreThreshold = $lastScore / 3; /* @var DOMElement $parentOfTopCandidate */ - while ($parentOfTopCandidate->nodeName !== 'body') { + // Check if we are actually dealing with a DOMNode and not a DOMDocument node or higher + while ($parentOfTopCandidate->nodeName !== 'body' && $parentOfTopCandidate->nodeType === XML_ELEMENT_NODE) { $parentScore = $parentOfTopCandidate->contentScore; if ($parentScore < $scoreThreshold) { break; |