diff options
-rw-r--r-- | src/HTMLParser.php | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/src/HTMLParser.php b/src/HTMLParser.php index 77c68cf..d4d10b9 100644 --- a/src/HTMLParser.php +++ b/src/HTMLParser.php @@ -1048,7 +1048,7 @@ class HTMLParser */ $h2 = $article->getElementsByTagName('h2'); if ($h2->length === 1) { - $lengthSimilarRate = (mb_strlen($h2->item(0)->textContent) - mb_strlen($this->metadata['title'])) / mb_strlen($this->metadata['title']); + $lengthSimilarRate = (mb_strlen($h2->item(0)->textContent) - mb_strlen($this->metadata['title'])) / max(mb_strlen($this->metadata['title']), 1); if (abs($lengthSimilarRate) < 0.5) { if ($lengthSimilarRate > 0) { |