Readability.php fatal error

Hello,

I would like to report an issue I found in the latest version of Readability.php. The error I got is the following:

PHP message: PHP Fatal error: Uncaught TypeError: preg_match(): Argument #2 ($subject) must be of type string, array given in /vendor/fivefilters/readability.php/src/Readability.php:372

The $parsed['@context'] seems to be an array instead of being a string. Adding an extra condition right before the erroneous line might fix the issue:
!is_string($parsed['@context']) ||

Can you fix this in a future update?

Thanks in advance.

Hello,
We just found another fatal error that occurs from time to time for us:

PHP Fatal error: Uncaught TypeError: fivefilters\Readability\Readability::textSimilarity(): Argument #1 ($textA) must be of type string, null given, called in /vendor/fivefilters/readability.php/src/Readability.php on line 2143 and defined in /vendor/fivefilters/readability.php/src/Readability.php:994

Can you check this one too?
Thanks.

Hi,
Here’s a third error from our logs:

PHP Fatal error: Uncaught TypeError: fivefilters\Readability\Readability::postProcessContent(): Argument #1 ($article) must be of type fivefilters\Readability\Nodes\DOM\DOMDocument, bool given, called in /vendor/fivefilters/readability.php/src/Readability.php on line 258 and defined in /vendor/fivefilters/readability.php/src/Readability.php:2186

Thanks for reporting this. We’re going to look into the errors. Are you able to provide an article URL or HTML file that results in this error in Readability.php?

Unfortunately, no, because the URLs are provided by our users and we didn’t store them in our logs.

Just a note to say we’ve added fixes for these in the latest commit. If you notice any other issues, please do let us know:

Thanks again for the bug reports.

1 Like

Thank you for the update!

1 Like