nextcloud / news

:newspaper: RSS/Atom feed reader
https://apps.nextcloud.com/apps/news
GNU Affero General Public License v3.0
860 stars 186 forks source link

Error in reference to object.. #2668

Open noci2012 opened 4 months ago

noci2012 commented 4 months ago

IMPORTANT

Read and tick the following checkbox after you have created the issue or place an x inside the brackets ;)

Explain the Problem

Call to a member function replaceChild() on null Error while running background job OCA\News\Cron\UpdaterJob (id: 611, arguments: null)

Steps to Reproduce

Explain what you did to encounter the issue

  1. Install
  2. Check Log after cron has been running
  3. Profit!

System Information

Contents of nextcloud/data/nextcloud.log Error ```json {"reqId":"dw0u5P4ppJcVWuB276vs","level":3,"time":"2024-05-19T15:55:22+00:00","remoteAddr":"","user":"--","app":"core","method":"","url":"--","message":"Error while running background job OCA\\News\\Cron\\UpdaterJob (id: 611, arguments: null)","userAgent":"--","version":"29.0.1.0","exception":{"Exception":"Error","Message":"Call to a member function replaceChild() on null","Code":0,"Trace":[{"file":"/var/www/nextcloud/apps/news/lib/Scraper/Scraper.php","line":78,"function":"parse","class":"fivefilters\\Readability\\Readability","type":"->"},{"file":"/var/www/nextcloud/apps/news/lib/Fetcher/FeedFetcher.php","line":167,"function":"scrape","class":"OCA\\News\\Scraper\\Scraper","type":"->"},{"file":"/var/www/nextcloud/apps/news/lib/Service/FeedServiceV2.php","line":279,"function":"fetch","class":"OCA\\News\\Fetcher\\FeedFetcher","type":"->"},{"file":"/var/www/nextcloud/apps/news/lib/Service/FeedServiceV2.php","line":364,"function":"fetch","class":"OCA\\News\\Service\\FeedServiceV2","type":"->"},{"file":"/var/www/nextcloud/apps/news/lib/Service/UpdaterService.php","line":63,"function":"fetchAll","class":"OCA\\News\\Service\\FeedServiceV2","type":"->"},{"file":"/var/www/nextcloud/apps/news/lib/Cron/UpdaterJob.php","line":74,"function":"update","class":"OCA\\News\\Service\\UpdaterService","type":"->","args":["*** sensitive parameters replaced ***"]},{"file":"/var/www/nextcloud/lib/public/BackgroundJob/Job.php","line":80,"function":"run","class":"OCA\\News\\Cron\\UpdaterJob","type":"->"},{"file":"/var/www/nextcloud/lib/public/BackgroundJob/TimedJob.php","line":102,"function":"start","class":"OCP\\BackgroundJob\\Job","type":"->"},{"file":"/var/www/nextcloud/lib/public/BackgroundJob/TimedJob.php","line":92,"function":"start","class":"OCP\\BackgroundJob\\TimedJob","type":"->"},{"file":"/var/www/nextcloud/cron.php","line":176,"function":"execute","class":"OCP\\BackgroundJob\\TimedJob","type":"->"}],"File":"/var/www/nextcloud/apps/news/vendor/fivefilters/readability.php/src/Readability.php","Line":227,"message":"Error while running background job OCA\\News\\Cron\\UpdaterJob (id: 611, arguments: null)","exception":[],"CustomMessage":"Error while running background job OCA\\News\\Cron\\UpdaterJob (id: 611, arguments: null)"},"id":"664a20f3df2cc"} ```
Contents of Browser Error Console Read http://ggnome.com/wiki/Using_The_Browser_Error_Console if you are unsure what to put here ``` Not relevant in cron job. ```
Grotax commented 4 months ago

Hi my first assumption would be that your php version is to modern for the scraping library that is behind the full text feature.

There is an upgrade available but to use it we had to drop support for PHP 8.0 I think.

noci2012 commented 4 months ago

Nextcloud 28/29 = PHP 8.3 too modern? ....
php 8.2 will be EOL startinf December 2024..., ie. 7 months of support left.

Grotax commented 4 months ago

Seems like you didn't understand me, which is fine. You can open a PR if you have a suggestion.

My tip would be to use a different distro for something like nextcloud + community apps. Rolling distros will be to fast with upgrades and not everything in PHP is backwards compatible.

noci2012 commented 4 months ago

First of all i am a sysadmin... (OpenVMS + Linux on the side), not a PHP programmer, i can read code and do simple patches so I guess a PR is a big ask.

grepping....repalceChild shows this file show hits. news/vendor/fivefilters/readability.php/src/Readability.php Here the objects are ....

The lib/Scanner/Scanner.php in the error is

    public function getRTL(bool $default = false): bool
    {
        if ($this->readability === null) {                        #<-- Line 78
            return $default;
        }

Version 8.4 is mentioned in recent changes (last month). (The supplied Readability library is from 2021 AFAICT).