summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorPedro Amorim <[email protected]>2017-11-22 14:47:55 +0100
committerPedro Amorim <[email protected]>2017-11-22 15:09:17 +0100
commitfac2a1cb5f33288ba4f18bfb337e5189852075b4 (patch)
tree1265371b6520f612c75986f42095c2ec66bbc750 /src
parentafe9d56e3d18b7552d494c7a05a1b995550b2e88 (diff)
Fix "Unsupported operand types"
Missing method "count" in if statement. PHP Fatal error: Uncaught Error: Unsupported operand types in vendor/andreskrey/readability.php/src/HTMLParser.php:622
Diffstat (limited to 'src')
-rw-r--r--src/HTMLParser.php3
1 files changed, 2 insertions, 1 deletions
diff --git a/src/HTMLParser.php b/src/HTMLParser.php
index 8c864cb..3565ba6 100644
--- a/src/HTMLParser.php
+++ b/src/HTMLParser.php
@@ -618,9 +618,10 @@ class HTMLParser
* the original title.
*/
$curTitleWordCount = count(preg_split('/\s+/', $curTitle));
+ $originalTitleWordCount = count(preg_split('/\s+/', preg_replace('/[\|\-\\\\\/>»]+/', '', $originalTitle))) - 1;
if ($curTitleWordCount <= 4 &&
- (!$titleHadHierarchicalSeparators || $curTitleWordCount !== preg_split('/\s+/', preg_replace('/[\|\-\\\\\/>»]+/', '', $originalTitle)) - 1)) {
+ (!$titleHadHierarchicalSeparators || $curTitleWordCount !== $originalTitleWordCount)) {
$curTitle = $originalTitle;
}