aboutsummaryrefslogtreecommitdiff
path: root/p/api/fever.php
diff options
context:
space:
mode:
authorGravatar Alexandre Alapetite <alexandre@alapetite.fr> 2023-03-22 09:57:31 +0100
committerGravatar GitHub <noreply@github.com> 2023-03-22 09:57:31 +0100
commite750448f5b32982170f81ca045f9f7e8dc8eed6f (patch)
tree4053a9bfdcc5764cdc8ed93e9be73f54da7bd9d4 /p/api/fever.php
parent1a0616562db5c096dc7ca187f0210b3d57bffebf (diff)
Consistent entry ID type (32-bit compatibility) (#5213)
* Remove FreshRSS_Searchable for better types The interface was not used, and it was preventing more precise types for the different `searchById()` methods, as they each have different input and output types. * Consistent entry ID Entry IDs (which are 64-bit integers) must be processed as string to be compatible with 32-bit platforms * Fix type * A few more related types * PHPStan level 6 * Some more casts needed * String cast for htmlspecialchars
Diffstat (limited to 'p/api/fever.php')
-rw-r--r--p/api/fever.php20
1 files changed, 10 insertions, 10 deletions
diff --git a/p/api/fever.php b/p/api/fever.php
index 1bc7068ab..7afe843e9 100644
--- a/p/api/fever.php
+++ b/p/api/fever.php
@@ -227,8 +227,8 @@ final class FeverAPI
}
if (isset($_REQUEST['mark'], $_REQUEST['as'], $_REQUEST['id']) && ctype_digit($_REQUEST['id'])) {
- $id = intval($_REQUEST['id']);
- $before = intval($_REQUEST['before'] ?? '0');
+ $id = (string)$_REQUEST['id'];
+ $before = (int)($_REQUEST['before'] ?? '0');
switch (strtolower($_REQUEST['mark'])) {
case 'item':
switch ($_REQUEST['as']) {
@@ -249,14 +249,14 @@ final class FeverAPI
case 'feed':
switch ($_REQUEST['as']) {
case 'read':
- $this->setFeedAsRead($id, $before);
+ $this->setFeedAsRead((int)$id, $before);
break;
}
break;
case 'group':
switch ($_REQUEST['as']) {
case 'read':
- $this->setGroupAsRead($id, $before);
+ $this->setGroupAsRead((int)$id, $before);
break;
}
break;
@@ -420,40 +420,40 @@ final class FeverAPI
}
private function getUnreadItemIds(): string {
- $entries = $this->entryDAO->listIdsWhere('a', '', FreshRSS_Entry::STATE_NOT_READ, 'ASC', 0) ?: [];
+ $entries = $this->entryDAO->listIdsWhere('a', 0, FreshRSS_Entry::STATE_NOT_READ, 'ASC', 0) ?: [];
return $this->entriesToIdList($entries);
}
private function getSavedItemIds(): string {
- $entries = $this->entryDAO->listIdsWhere('a', '', FreshRSS_Entry::STATE_FAVORITE, 'ASC', 0) ?: [];
+ $entries = $this->entryDAO->listIdsWhere('a', 0, FreshRSS_Entry::STATE_FAVORITE, 'ASC', 0) ?: [];
return $this->entriesToIdList($entries);
}
/**
* @return integer|false
*/
- private function setItemAsRead(int $id) {
+ private function setItemAsRead(string $id) {
return $this->entryDAO->markRead($id, true);
}
/**
* @return integer|false
*/
- private function setItemAsUnread(int $id) {
+ private function setItemAsUnread(string $id) {
return $this->entryDAO->markRead($id, false);
}
/**
* @return integer|false
*/
- private function setItemAsSaved(int $id) {
+ private function setItemAsSaved(string $id) {
return $this->entryDAO->markFavorite($id, true);
}
/**
* @return integer|false
*/
- private function setItemAsUnsaved(int $id) {
+ private function setItemAsUnsaved(string $id) {
return $this->entryDAO->markFavorite($id, false);
}