Ver Fonte

Fix SQL bind bug when adding tag (#8101)

Error in SQLite: `SQL error FreshRSS_TagDAO::addTag["HY000",25,"column index out of range"]`
Alexandre Alapetite há 5 meses atrás
pai
commit
348b6e358b
1 ficheiros alterados com 3 adições e 1 exclusões
  1. 3 1
      app/Models/TagDAO.php

+ 3 - 1
app/Models/TagDAO.php

@@ -37,7 +37,9 @@ SQL;
 			$valuesTmp['attributes'] = [];
 		}
 		if ($stm !== false) {
-			$stm->bindValue(':id', empty($valuesTmp['id']) ? null : $valuesTmp['id'], PDO::PARAM_INT);
+			if (!empty($valuesTmp['id'])) {
+				$stm->bindValue(':id', $valuesTmp['id'], PDO::PARAM_INT);
+			}
 			$stm->bindValue(':name1', $valuesTmp['name'], PDO::PARAM_STR);
 			$stm->bindValue(':name2', $valuesTmp['name'], PDO::PARAM_STR);
 			$stm->bindValue(':attributes', is_string($valuesTmp['attributes']) ? $valuesTmp['attributes'] :