From 2c17db9dfc8c5d245d6a7c33646b82ce2964fea4 Mon Sep 17 00:00:00 2001 From: Tom Date: Sat, 16 Jul 2022 15:29:07 +0200 Subject: [PATCH 1/3] Fix subscribe and unsubscribe --- src/RedditAPI.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/RedditAPI.php b/src/RedditAPI.php index 8dd41a0..d558dbf 100644 --- a/src/RedditAPI.php +++ b/src/RedditAPI.php @@ -2851,12 +2851,12 @@ public function searchSubredditsByTopic($query): array public function subscribe($subreddit) { $subreddit_info = $this->aboutSubreddit($subreddit); - if (!isset($subreddit_info->data->name)) { + if (!isset($subreddit_info["data"]["name"])) { return null; } $params = [ 'action' => 'sub', - 'sr' => $subreddit_info->data->name, + 'sr' => $subreddit_info["data"]["name"], ]; return $this->apiCall('/api/subscribe', 'POST', $params); @@ -2872,12 +2872,12 @@ public function subscribe($subreddit) public function unsubscribe($subreddit) { $subreddit_info = $this->aboutSubreddit($subreddit); - if (!isset($subreddit_info->data->name)) { + if (!isset($subreddit_info["data"]["name"])) { return null; } $params = [ 'action' => 'unsub', - 'sr' => $subreddit_info->data->name, + 'sr' => $subreddit_info["data"]["name"], ]; return $this->apiCall('/api/subscribe', 'POST', $params); From ec252bb4f01a368233cfe44a6e819abd17135bc0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tom=20Maa=C3=9F?= Date: Fri, 27 Oct 2023 15:46:12 +0200 Subject: [PATCH 2/3] Update to php 8.1 --- composer.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/composer.json b/composer.json index 3861443..6d66737 100755 --- a/composer.json +++ b/composer.json @@ -19,10 +19,10 @@ } ], "require": { - "php": "^7.2", + "php": "^8.1", "ext-curl": "*", "ext-json": "*", - "illuminate/support": "^6.0|^7.0|^8.0|^9.0" + "illuminate/support": "^6.0|^7.0|^8.0|^9.0|^10.0" }, "require-dev": { "friendsofphp/php-cs-fixer": "^2.16", From 508feace9772cd0c674c20950eea39e66e48b93c Mon Sep 17 00:00:00 2001 From: phantomate <102902464+phantomate@users.noreply.github.com> Date: Sat, 5 Oct 2024 10:49:24 +0200 Subject: [PATCH 3/3] Update RedditRateLimiter.php Fix implicit conversation from float to int error --- src/RedditRateLimiter.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/RedditRateLimiter.php b/src/RedditRateLimiter.php index e23337c..0f5d2a5 100644 --- a/src/RedditRateLimiter.php +++ b/src/RedditRateLimiter.php @@ -52,7 +52,7 @@ public function wait(): void $now = microtime(true) * 10000; $wait_until = $this->last_request + ($this->interval * 10000); if ($this->enabled && $now < $wait_until) { - usleep(($wait_until - $now) * 100); + usleep(round(($wait_until - $now) * 100)); } $this->last_request = microtime(true) * 10000; }