[af_readability] usort(): Returning bool from comparison function is deprecated, return an integer less than, equal to, or greater than zero

Are you using stock Docker compose setup?

Yes.


Describe the problem you’re having:

Warning message:

usort(): Returning bool from comparison function is deprecated, return an integer less than, equal to, or greater than zero
1. plugins/af_readability/vendor/andreskrey/Readability/Readability.php(199): usort([[{"articleContent":{"contentScore":0},"textLength":43},{"articleContent":{"contentScore":0},"textLength":43},{"articleContent":{"contentScore":0},"textLength":43},{"articleContent":{"contentScore":0},"textLength":43}], {Closure})
2. plugins/af_readability/init.php(217): parse(
    <!DOCTYPE html>
    <html lang="en-US">
      <head>
        <script>
    var __SUPPORTS_TIMING_API = typeof performance === 'object' && !!performance.mark && !! performance.measure && !!performance.getEntriesByType;
    function __perfMark(name) { __...)
3. plugins/af_readability/init.php(332): extract_content(https://www.reddit.com/r/netsec/comments/lqdmeo/wp_gdpr_compliance_155_unauthenticated_crosssite/)
4. classes/pluginhandler.php(15): embed()
5. backend.php(137): catchall(embed)

Real IP: <elided>
Forwarded For: <elided>
Forwarded Protocol: http
Remote IP: 172.18.0.1
Request URI: /tt-rss/backend.php
User agent: Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/88.0.4324.186 Safari/537.36	

Include steps to reproduce the problem:

Seems to crop up whenever I enable af_readability on a feed, but probably happens on each update.

tt-rss version (including git commit id):

git graph | head
*   1baf8c521 (HEAD -> master, origin/master, origin/HEAD) Merge pull request 'Fix the type hint for '_DEFAULT_VIEW_MODE'.' (#9) from wn/tt-rss:bugfix/default-view-mode-type into master
|\
| * 86513d70d Fix the type hint for '_DEFAULT_VIEW_MODE'.
* | d577eb898 when browsing by tags, return same set of columns as normally
* | c01b6e43f add pluginhost->get_array() shorthand
|/
* bf9033beb rebase-translations: disable everything except for messages.pot
* 167c9fc34 silence php8 warnings in otp secondary login form

Platform (i.e. Linux distro, PHP, PostgreSQL, etc) versions:

Docker.

Please provide any additional information below:

why not report this to the guy who wrote the library?

Ugh - sorry; I thought it was part of the stock install, since it was there when I created the docker setup yesterday.

don’t report just yet, i’ll pull the latest version first and maybe it’s fixed already

e: gonna use composer i guess :frowning:

e2: https://git.tt-rss.org/fox/tt-rss/commit/cf1ede0ba8c687d9bfadf1c372546657968f1dd8

I can’t find who wrote it - there’s only your name showing up on git blame and I can’t find any other identifiers in the code, and Google isn’t helping.

It’s this return it’s complaining about:

 git blame Readability.php| grep usort -A4
2aaefbfa54 vendor/andreskrey/Readability/Readability.php                        (Andrew Dolgov 2018-06-20 14:58:09 +0300  197)                     usort($this->attempts, function ($a, $b) {
2aaefbfa54 vendor/andreskrey/Readability/Readability.php                        (Andrew Dolgov 2018-06-20 14:58:09 +0300  198)                         return $a['textLength'] < $b['textLength'];
2aaefbfa54 vendor/andreskrey/Readability/Readability.php                        (Andrew Dolgov 2018-06-20 14:58:09 +0300  199)                     });
2aaefbfa54 vendor/andreskrey/Readability/Readability.php                        (Andrew Dolgov 2018-06-20 14:58:09 +0300  200)
2aaefbfa54 vendor/andreskrey/Readability/Readability.php                        (Andrew Dolgov 2018-06-20 14:58:09 +0300  201)                     // But first check if we actually have something

Replacing that < with a - should fix it.

but like i said above try the updated version first

Nah - still thows the warning. I’ll go see if it’s been reported.

Reported.

For the interested:

three months later, these people still can’t get their shit together enough to merge a one line change. pathetic.

https://git.tt-rss.org/fox/tt-rss/commit/92c78beb909d8955657564127c2e953ca25113e3

Just leaving note, that GitHub - andreskrey/readability.php: PHP port of Mozilla's Readability.js is abandoned in favor of GitHub - fivefilters/readability.php: PHP port of Mozilla's Readability.js

ah, very nice. i made a note to switch readability plugin to this fork when i have some time to kill.

I noticed that the dependency “andreskrey/readability.php” of plugin “af_readability” has been abandoned and is now maintained by fivefilters, who already committed numerous improvements.
I updated the reference in the composer.json file and added all remote changes to the pull request.
My goal is to improve functionality and quality of the readability transformation of article contents.

git.tt-rss DOT org/fox/tt-rss/pulls/42

tons of files being renamed aside, i haven’t noticed any changes in particular that looked important.

also, usort bug is not fixed.

Yes thats because they didn’t release a new version yet, their improvements are only in master, but version in composer.json file says "^2.1"
We could change that to "dev-master" or simply wait until they release 2.2

we might as well wait. also, now i remember where i heard this name before, fivefilters are people who held readability-php code hostage for their saas service, releasing obsolete versions infrequently for the public to comply with gpl or whatever. we’ll see how it goes this time.

Elapsed time +9 months
Last comment from fivefilters was in Feb '22:

…at the moment you’ll have to rely on dev-master to run the latest changes in the repository. We’d been planning to roll out new versions of our own software to some users as a way to test the library in wider use. We’ve been too busy with other things so far, but that’s still the plan. Then we’ll know if we’re ready for a new versioned release here.

ah so they did purchase a competitor to kill it. how unexpected.