From 0206fc1e5ea31d6a97838425153b8826d80fa3d6 Mon Sep 17 00:00:00 2001 From: Alexandre Alapetite Date: Sun, 7 Mar 2021 19:41:17 +0100 Subject: [PATCH] fix updateEntryPrepared (#3500) --- app/Models/EntryDAO.php | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/app/Models/EntryDAO.php b/app/Models/EntryDAO.php index c6c4af62a..c641878ad 100644 --- a/app/Models/EntryDAO.php +++ b/app/Models/EntryDAO.php @@ -187,10 +187,10 @@ SQL; $sql = 'UPDATE `_entry` ' . 'SET title=:title, author=:author, ' . ($this->isCompressed() ? 'content_bin=COMPRESS(:content)' : 'content=:content') - . ', link=:link, date=:date, `lastSeen`=:last_seen, ' - . 'hash=' . $this->sqlHexDecode(':hash') - . ', ' . ($valuesTmp['is_read'] === null ? '' : 'is_read=:is_read, ') - . 'tags=:tags ' + . ', link=:link, date=:date, `lastSeen`=:last_seen' + . ', hash=' . $this->sqlHexDecode(':hash') + . ', is_read=COALESCE(:is_read, is_read)' + . ', tags=:tags ' . 'WHERE id_feed=:id_feed AND guid=:guid'; $this->updateEntryPrepared = $this->pdo->prepare($sql); } @@ -213,7 +213,9 @@ SQL; $this->updateEntryPrepared->bindParam(':date', $valuesTmp['date'], PDO::PARAM_INT); $valuesTmp['lastSeen'] = time(); $this->updateEntryPrepared->bindParam(':last_seen', $valuesTmp['lastSeen'], PDO::PARAM_INT); - if ($valuesTmp['is_read'] !== null) { + if ($valuesTmp['is_read'] === null) { + $this->updateEntryPrepared->bindValue(':is_read', null, PDO::PARAM_NULL); + } else { $this->updateEntryPrepared->bindValue(':is_read', $valuesTmp['is_read'] ? 1 : 0, PDO::PARAM_INT); } $this->updateEntryPrepared->bindParam(':id_feed', $valuesTmp['id_feed'], PDO::PARAM_INT);