feediron / ttrss_plugin-feediron

Evolution of ttrss_plugin-af_feedmod
https://discourse.tt-rss.org/t/plugin-update-feediron-v1-2-0/2018
MIT License
211 stars 34 forks source link

Filtered/deleted articles get passed through feediron, causing PHP warnings #204

Open uqs opened 3 months ago

uqs commented 3 months ago

Prerequisites

Expected Behavior

Some of these were fixed in #189, but I encounter some more (and adding pages via the bookmarklet results in empty articles, maybe that is related).

Current Behavior

These warning show up over and over again, see below

Steps to Reproduce

Failure Information (for bugs)

Failure Logs ``` E_WARNING (2) plugins.local/feediron/init.php:142 Undefined array key "plugin_data" 1. plugins.local/feediron/init.php(142): ttrss_error_handler(Undefined array key "plugin_data", plugins.local/feediron/init.php) 2. plugins.local/feediron/init.php(98): addArticleMarker([{"owner_uid":1,"guid":"1,894ad759-8eba-4eab-a2f1-731ddb8e5799","guid_hashed":"{\"ver\":2,\"uid\":1,\"hash\":\"SHA1:93302c0f9c54d3c8774c6ac30cc1c8fb35fc328b\"}","title":"Marktbericht: US-B\u00f6rsen auf gro\u00dfer Talfahrt","content":"

Context

  • Operating System: FreeBSD 14.1
  • TTRSS version/git version: 20240421
  • PHP version: 8.2
  • Feediron Configuration:

feediron pulled just an hour ago, so at 8ac460ee7156465eaad0323d6c68e84058f9ef1c

I also had lots of "not an array" errors before and have applied this patch to shut up that warning when not-an-array is passed in:

diff --git a/init.php b/init.php
index b98dc17..53842b8 100644
--- a/init.php
+++ b/init.php
@@ -121,7 +121,7 @@ class Feediron extends Plugin implements IHandler
   }

   function array_check($array, $key){
-    if( array_key_exists($key, $array) && is_array($array[$key]) ){
+    if (is_array($array) && array_key_exists($key, $array) && is_array($array[$key]) ){
       return true;
     } else {
       return false;
dugite-code commented 3 months ago

Can you post your config as well? This really should only be presenting if an incorrect config is passed (If memory serves).

This function should also be moved to fi_helper.php alongside the array_check function (or integrated somehow)

uqs commented 3 months ago

Ah, sorry for the noise. I can't repro this. It turns out the lack of article body when using the bookmarklet was due to lack of the af_readability plugin. That must've moved from core to an optional plugin with the update, or something like that.

And I get no more of these PHP errors when downloading feeds or testing the rewrites.

Now I can move to the actual problem, which is Reddit RSS feeds showing their image as a teeny, tiny icon in the mobile view. This is probably due a style update on their end, sigh.

uqs commented 3 months ago

Hmpf, spoken too soon. It takes 30min for another run which then triggers the same errors every 30 minutes.

So this is still an issue, but it affects filtered articles!

  1. This feed: http://www.tagesschau.de/xml/atom
  2. Plus these filters that delete the article: Matches: Liveblog|^Live(stream)?: on Title in tagesschau.de ^(Podcast )?11KM on Title in tagesschau.de ^Marktbericht on Title in tagesschau.de Action: Delete article
  3. This feediron:
{    "tagesschau.de": {
        "type": "xpath",
        "xpath": "article[contains(@class, 'container')]",
        "modify": [
            {
                "type": "regex",
                "pattern": "\/(<img[^>]*?src=.)\\\/\/",
                "replace": "$1https:\/\/www.tagesschau.de\/"
            }
        ],
        "cleanup": [
            "div[contains(@class, 'id-card')]",
            "div[contains(@class, 'teaser-absatz')]",
            "div[contains(@class, 'authorline')]"
        ]
    }
}

It seems that a filtered/deleted article is still getting passed through feediron, which is a bit silly