Fix bigint timestamps on 32-bit (#7375)

* Fix bigint timestamps on 32-bit
fix https://github.com/FreshRSS/FreshRSS/issues/7374
SQL requests for BIGINT fields may return a string on 32-bit systems instead of an integer

* Calculations may also be string
This commit is contained in:
Alexandre Alapetite
2025-02-26 17:01:25 +01:00
committed by GitHub
parent 943049890a
commit 5f6ef05ffc
4 changed files with 25 additions and 7 deletions

View File

@@ -58,9 +58,15 @@ class FreshRSS_Category extends Minz_Model {
public function lastUpdate(): int {
return $this->lastUpdate;
}
public function _lastUpdate(int $value): void {
$this->lastUpdate = $value;
/**
* @param int|numeric-string $value
* 32-bit systems provide a string and will fail in year 2038
*/
public function _lastUpdate(int|string $value): void {
$this->lastUpdate = (int)$value;
}
public function inError(): bool {
return $this->error;
}

View File

@@ -546,7 +546,12 @@ HTML;
$this->date = $value > 1 ? $value : time();
}
public function _lastSeen(int $value): void {
/**
* @param int|numeric-string $value
* 32-bit systems provide a string and will fail in year 2038
*/
public function _lastSeen(int|string $value): void {
$value = (int)$value;
$this->lastSeen = $value > 0 ? $value : 0;
}

View File

@@ -308,9 +308,15 @@ class FreshRSS_Feed extends Minz_Model {
public function _description(string $value): void {
$this->description = $value == '' ? '' : $value;
}
public function _lastUpdate(int $value): void {
$this->lastUpdate = $value;
/**
* @param int|numeric-string $value
* 32-bit systems provide a string and will fail in year 2038
*/
public function _lastUpdate(int|string $value): void {
$this->lastUpdate = (int)$value;
}
public function _priority(int $value): void {
$this->priority = $value;
}

View File

@@ -49,7 +49,8 @@ class FreshRSS_Tag extends Minz_Model {
return $this->nbUnread;
}
public function _nbUnread(int $value): void {
$this->nbUnread = $value;
/** @param int|numeric-string $value */
public function _nbUnread(int|string $value): void {
$this->nbUnread = (int)$value;
}
}