Skip to content

Commit 772e4f1

Browse files
authored
fix: Only decode json if it's a string (DenverCoder1#401)
1 parent 8472129 commit 772e4f1

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/stats.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -155,7 +155,7 @@ function fetchGraphQL(string $query): stdClass
155155
$ch = getGraphQLCurlHandle($query);
156156
$response = curl_exec($ch);
157157
curl_close($ch);
158-
$obj = json_decode($response);
158+
$obj = is_string($response) ? json_decode($response) : null;
159159
// handle curl errors
160160
if ($response === false || $obj === null || curl_getinfo($ch, CURLINFO_HTTP_CODE) >= 400) {
161161
// set response code to curl error code

0 commit comments

Comments
 (0)