Переглянути джерело

Fix some PHPstan errors (#4019)

Fix some wrong variables found by https://github.com/FreshRSS/FreshRSS/issues/4016
Alexandre Alapetite 4 роки тому
батько
коміт
00dbde68fb
4 змінених файлів з 6 додано та 6 видалено
  1. 1 1
      app/Models/FeedDAO.php
  2. 1 1
      app/Models/Tag.php
  3. 3 3
      app/Models/UserDAO.php
  4. 1 1
      p/ext.php

+ 1 - 1
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));

+ 1 - 1
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) {

+ 3 - 3
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;
 		}
 	}

+ 1 - 1
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) {