From ed74c43f18998d6e3469203dd71109d519fd4f2e Mon Sep 17 00:00:00 2001 From: wn_ Date: Tue, 14 Dec 2021 12:06:32 +0000 Subject: [PATCH 1/3] Handle the admin user not having any entries in 'Feeds::_get_global_unread'. --- classes/feeds.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/classes/feeds.php b/classes/feeds.php index a9afb70f2..3c0578782 100755 --- a/classes/feeds.php +++ b/classes/feeds.php @@ -1359,7 +1359,7 @@ class Feeds extends Handler_Protected { $sth->execute([$user_id]); $row = $sth->fetch(); - return $row["count"]; + return $row["count"] ?? 0; } static function _get_cat_title(int $cat_id): string { From ddc81b2c8979904bd042efd0412d93fb7c821903 Mon Sep 17 00:00:00 2001 From: wn_ Date: Tue, 14 Dec 2021 12:47:25 +0000 Subject: [PATCH 2/3] Add a note on why ed74c43f18 was needed. --- classes/feeds.php | 1 + 1 file changed, 1 insertion(+) diff --git a/classes/feeds.php b/classes/feeds.php index 3c0578782..2a4fe4993 100755 --- a/classes/feeds.php +++ b/classes/feeds.php @@ -1359,6 +1359,7 @@ class Feeds extends Handler_Protected { $sth->execute([$user_id]); $row = $sth->fetch(); + // Handle 'SUM()' returning null if there are no articles/results (e.g. admin user with no feeds) return $row["count"] ?? 0; } From 0726a9d820855f96dccf873e6279f74479800efb Mon Sep 17 00:00:00 2001 From: wn_ Date: Tue, 14 Dec 2021 12:50:53 +0000 Subject: [PATCH 3/3] Handle another potential 'SUM()' null situation in Feeds. --- classes/feeds.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/classes/feeds.php b/classes/feeds.php index 2a4fe4993..62fd6a5b3 100755 --- a/classes/feeds.php +++ b/classes/feeds.php @@ -955,7 +955,8 @@ class Feeds extends Handler_Protected { $sth->execute([$owner_uid, $feed]); $row = $sth->fetch(); - return $row["count"]; + // Handle 'SUM()' returning null if there are no results + return $row["count"] ?? 0; } else if ($n_feed == -1) { $match_part = "marked = true";