Skip to content

A free, self-hostable news aggregator…

Fix SQL bind bug when adding tag (#8101)

Alexandre Alapetite348b6e358b0b
diff --git a/app/Models/TagDAO.php b/app/Models/TagDAO.php
index 4555018d0..e18cb7b2a 100644
--- a/app/Models/TagDAO.php
+++ b/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'] :