From 8a3f154b49c308ad8cc748caf842b7759132ea34 Mon Sep 17 00:00:00 2001 From: Thomas Corbett Date: Fri, 22 Mar 2024 16:39:35 +0000 Subject: [PATCH] Handle case of GitHub returning 204 No Content in some scenarios which breaks ResultPager because no array is returned (it's an empty string) - issue ResultPager::get() can return string #1091 --- lib/Github/ResultPager.php | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/lib/Github/ResultPager.php b/lib/Github/ResultPager.php index cfd1d605e4f..61e6c17ae60 100644 --- a/lib/Github/ResultPager.php +++ b/lib/Github/ResultPager.php @@ -86,6 +86,10 @@ public function fetch(AbstractApi $api, string $method, array $parameters = []): $api = $closure($api); $result = $api->$method(...$parameters); + if ($result === "" && $this->client->getLastResponse()->getStatusCode() === 204) { + $result = []; + } + $this->postFetch(true); return $result;