Skip to content

Commit

Permalink
getRawData - return empty array on non array json response
Browse files Browse the repository at this point in the history
  • Loading branch information
PawelSuwinski committed May 8, 2023
1 parent 19d1ca7 commit f2d8e4b
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 4 deletions.
3 changes: 2 additions & 1 deletion src/GrantType/AuthorizationCode.php
Original file line number Diff line number Diff line change
Expand Up @@ -66,8 +66,9 @@ public function getRawData(SignerInterface $clientCredentialsSigner, $refreshTok
);

$response = $this->client->send($request);
$rawData = json_decode($response->getBody(), true);

return (array) json_decode($response->getBody(), true);
return is_array($rawData) ? $rawData : [];
}

/**
Expand Down
3 changes: 2 additions & 1 deletion src/GrantType/ClientCredentials.php
Original file line number Diff line number Diff line change
Expand Up @@ -68,8 +68,9 @@ public function getRawData(SignerInterface $clientCredentialsSigner, $refreshTok
);

$response = $this->client->send($request);
$rawData = json_decode($response->getBody(), true);

return (array) json_decode($response->getBody(), true);
return is_array($rawData) ? $rawData : [];
}

/**
Expand Down
3 changes: 2 additions & 1 deletion src/GrantType/PasswordCredentials.php
Original file line number Diff line number Diff line change
Expand Up @@ -66,8 +66,9 @@ public function getRawData(SignerInterface $clientCredentialsSigner, $refreshTok
);

$response = $this->client->send($request);
$rawData = json_decode($response->getBody(), true);

return (array) json_decode($response->getBody(), true);
return is_array($rawData) ? $rawData : [];
}

/**
Expand Down
3 changes: 2 additions & 1 deletion src/GrantType/RefreshToken.php
Original file line number Diff line number Diff line change
Expand Up @@ -65,8 +65,9 @@ public function getRawData(SignerInterface $clientCredentialsSigner, $refreshTok
);

$response = $this->client->send($request);
$rawData = json_decode($response->getBody(), true);

return (array) json_decode($response->getBody(), true);
return is_array($rawData) ? $rawData : [];
}

/**
Expand Down

0 comments on commit f2d8e4b

Please sign in to comment.