Skip to content

Commit

Permalink
Prevent Illegal string offset 'warning_queries'
Browse files Browse the repository at this point in the history
Prevent Illegal string offset 'warning_queries' exception from not Arrayable responses.
  • Loading branch information
oele-dev authored Feb 20, 2020
1 parent 6a5689c commit 4b65a19
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/Outputs/Json.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,10 @@ public function output(Collection $detectedQueries, Response $response)
{
if ($response instanceof JsonResponse) {
$data = $response->getData(true);
if (! is_array($data)){
$data = [ $data ];
}

$data['warning_queries'] = $detectedQueries;
$response->setData($data);
}
Expand Down

0 comments on commit 4b65a19

Please sign in to comment.