Fix some PHPstan errors (#4019)

Fix some wrong variables found by https://github.com/FreshRSS/FreshRSS/issues/4016
This commit is contained in:
Alexandre Alapetite
2021-12-02 23:30:13 +01:00
committed by GitHub
parent a2ab9cf83a
commit 00dbde68fb
4 changed files with 6 additions and 6 deletions

View File

@@ -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));

View File

@@ -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) {

View File

@@ -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;
}
}

View File

@@ -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) {