From a8ef1c3c10f95f98c4a8425f18224a0cbf31f118 Mon Sep 17 00:00:00 2001 From: Alexandre Alapetite Date: Sat, 11 Jan 2025 15:33:57 +0100 Subject: Fix stats for MySQL (#7212) fix https://github.com/FreshRSS/FreshRSS/issues/7210 MySQL returns decimal for some columns, which get converted to string instead of integer in PHP --- app/Models/StatsDAO.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/app/Models/StatsDAO.php b/app/Models/StatsDAO.php index d098b81a4..771a2c7ee 100644 --- a/app/Models/StatsDAO.php +++ b/app/Models/StatsDAO.php @@ -36,7 +36,7 @@ class FreshRSS_StatsDAO extends Minz_ModelPdo { if ($only_main) { $filter .= 'AND f.priority = 10'; } - if (!is_null($feed)) { + if ($feed !== null) { $filter .= "AND e.id_feed = {$feed}"; } $sql = <<fetchAssoc($sql); - if (is_array($res) && !empty($res[0])) { - $dao = $res[0]; + if (is_array($res) && !empty($res[0]) && is_array($res[0])) { + $dao = array_map('intval', $res[0]); /** @var array{total:int,count_unreads:int,count_reads:int,count_favorites:int} $dao */ return $dao; } -- cgit v1.2.3