Browse Source

Ensure maximum date int (#3259)

#fix https://github.com/FreshRSS/FreshRSS/issues/3258
Alexandre Alapetite 5 years ago
parent
commit
08a5cf5946
1 changed files with 2 additions and 0 deletions
  1. 2 0
      app/Models/EntryDAO.php

+ 2 - 0
app/Models/EntryDAO.php

@@ -109,6 +109,7 @@ SQL;
 			$valuesTmp['link'] = substr($valuesTmp['link'], 0, 1023);
 			$valuesTmp['link'] = safe_ascii($valuesTmp['link']);
 			$this->addEntryPrepared->bindParam(':link', $valuesTmp['link']);
+			$valuesTmp['date'] = min($valuesTmp['date'], 2147483647);
 			$this->addEntryPrepared->bindParam(':date', $valuesTmp['date'], PDO::PARAM_INT);
 			if (empty($valuesTmp['lastSeen'])) {
 				$valuesTmp['lastSeen'] = time();
@@ -203,6 +204,7 @@ SQL;
 		$valuesTmp['link'] = substr($valuesTmp['link'], 0, 1023);
 		$valuesTmp['link'] = safe_ascii($valuesTmp['link']);
 		$this->updateEntryPrepared->bindParam(':link', $valuesTmp['link']);
+		$valuesTmp['date'] = min($valuesTmp['date'], 2147483647);
 		$this->updateEntryPrepared->bindParam(':date', $valuesTmp['date'], PDO::PARAM_INT);
 		$valuesTmp['lastSeen'] = time();
 		$this->updateEntryPrepared->bindParam(':last_seen', $valuesTmp['lastSeen'], PDO::PARAM_INT);