From 857736c6e90fbe2da8cb870855e84f04e8e67aee Mon Sep 17 00:00:00 2001 From: Andres Rey Date: Mon, 6 Nov 2017 18:36:35 +0000 Subject: Check for maxDepth before continuing --- src/Readability.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/Readability.php b/src/Readability.php index 5e0d4b4..b0a5830 100644 --- a/src/Readability.php +++ b/src/Readability.php @@ -472,7 +472,7 @@ class Readability extends Element implements ReadabilityInterface { $depth = 0; while ($node->getParent()) { - if ($depth > $maxDepth) { + if ($maxDepth > 0 && $depth > $maxDepth) { return false; } if ($node->getParent()->tagNameEqualsTo($tagName)) { -- cgit v1.2.3