Undefined index: feed_id in classes/api.php

One of my clients for iOS produces the following errors in classes/api.php:

Undefined index: feed_id
1. classes/api.php(101): ttrss_error_handler(8, Undefined index: feed_id, classes/api.php, 101, [[])
2. api/index.php(55): getUnread()

Request URI: /tt-rss/api/
User agent: tiny Reader/2.1.4 (com.pluchon.tiny-Reader; build:2.1.4.2; iOS 14.4.0) Alamofire/4.9.1

Undefined index: is_cat
1. classes/api.php(102): ttrss_error_handler(8, Undefined index: is_cat, classes/api.php, 102, [{"feed_id":null})
2. api/index.php(55): getUnread()

Request URI: /tt-rss/api/
User agent: tiny Reader/2.1.4 (com.pluchon.tiny-Reader; build:2.1.4.2; iOS 14.4.0) Alamofire/4.9.1

Here is a patch to avoid these:

--- api.php.bak 2021-03-01 10:20:14.635099101 +0100
+++ api.php     2021-03-01 10:47:41.529864344 +0100
@@ -98,8 +98,8 @@
        }
 
        function getUnread() {
-               $feed_id = clean($_REQUEST["feed_id"]);
-               $is_cat = clean($_REQUEST["is_cat"]);
+               $feed_id = clean(isset($_REQUEST["feed_id"]) ? $_REQUEST["feed_id"] : null);
+               $is_cat = clean(isset($_REQUEST["is_cat"]) ? $_REQUEST["is_cat"] : null);
 
                if ($feed_id) {
                        $this->_wrap(self::STATUS_OK, array("unread" => getFeedUnread($feed_id, $is_cat)));

can you submit a pr?

using a proper notation though i.e. ?? and “” instead of null

Don’t know how to do that.

Okay I took a stab at this since I had tons of these errors filling my logs.

full disclaimer I don’t know how to code (even though the libs keep telling me to learn) and I’ve never before used git. So go easy on me.

https://git.tt-rss.org/fox/tt-rss/pulls/12

Also getting the same error from the classes/handler/public.php getUnread() function where it says undefined index fresh.

This comes from using a script to get the number of unread posts from calling public.php?op=getUnread&login=username. The error goes away if you add &fresh=0 to the parameters.