From 00dbde68fbaf7da68ccf191c33f2de88d3603aa8 Mon Sep 17 00:00:00 2001 From: Alexandre Alapetite Date: Thu, 2 Dec 2021 23:30:13 +0100 Subject: Fix some PHPstan errors (#4019) Fix some wrong variables found by https://github.com/FreshRSS/FreshRSS/issues/4016 --- app/Models/FeedDAO.php | 2 +- app/Models/Tag.php | 2 +- app/Models/UserDAO.php | 6 +++--- p/ext.php | 2 +- 4 files changed, 6 insertions(+), 6 deletions(-) diff --git a/app/Models/FeedDAO.php b/app/Models/FeedDAO.php index 0d65e171d..150bbe921 100644 --- a/app/Models/FeedDAO.php +++ b/app/Models/FeedDAO.php @@ -460,7 +460,7 @@ SQL; . 'SET `cache_nbUnreads`=`cache_nbUnreads`-' . $affected . ' WHERE id=:id'; $stm = $this->pdo->prepare($sql); - $stm->bindParam(':id', $id_feed, PDO::PARAM_INT); + $stm->bindParam(':id', $id, PDO::PARAM_INT); if (!($stm && $stm->execute())) { $info = $stm == null ? $this->pdo->errorInfo() : $stm->errorInfo(); Minz_Log::error('SQL error keepMaxUnread cache: ' . json_encode($info)); diff --git a/app/Models/Tag.php b/app/Models/Tag.php index 0d50e356c..199e03b85 100644 --- a/app/Models/Tag.php +++ b/app/Models/Tag.php @@ -55,7 +55,7 @@ class FreshRSS_Tag extends Minz_Model { $tagDAO = FreshRSS_Factory::createTagDao(); $this->nbEntries = $tagDAO->countEntries($this->id()); } - return $this->nbFeed; + return $this->nbEntries; } public function _nbEntries($value) { diff --git a/app/Models/UserDAO.php b/app/Models/UserDAO.php index 266c8bc0e..1596fa5cc 100644 --- a/app/Models/UserDAO.php +++ b/app/Models/UserDAO.php @@ -14,7 +14,7 @@ class FreshRSS_UserDAO extends Minz_ModelPdo { if ($ok) { return true; } else { - $info = empty($stm) ? $this->pdo->errorInfo() : $stm->errorInfo(); + $info = $this->pdo->errorInfo(); Minz_Log::error(__METHOD__ . ' error: ' . json_encode($info)); return false; } @@ -31,8 +31,8 @@ class FreshRSS_UserDAO extends Minz_ModelPdo { if ($ok) { return true; } else { - $info = $stm == null ? $this->pdo->errorInfo() : $stm->errorInfo(); - Minz_Log::error(__METHOD__ . ' error: ' . $info[2]); + $info = $this->pdo->errorInfo(); + Minz_Log::error(__METHOD__ . ' error: ' . json_encode($info)); return false; } } diff --git a/p/ext.php b/p/ext.php index c464f05ab..a19c9e90e 100644 --- a/p/ext.php +++ b/p/ext.php @@ -80,7 +80,7 @@ function is_valid_path_extension($path, $extensionPath, $isStatic = true) { */ function is_valid_path($path) { return is_valid_path_extension($path, CORE_EXTENSIONS_PATH) || is_valid_path_extension($path, THIRDPARTY_EXTENSIONS_PATH) - || is_valid_path_extension($path, USERS_PATH, $false); + || is_valid_path_extension($path, USERS_PATH, false); } function sendBadRequestResponse(string $message = null) { -- cgit v1.2.3