From 4b65a19b5e6cd775f9316ee3660ca3086e453906 Mon Sep 17 00:00:00 2001 From: "@oele_co" Date: Thu, 20 Feb 2020 15:20:02 -0500 Subject: [PATCH] Prevent Illegal string offset 'warning_queries' Prevent Illegal string offset 'warning_queries' exception from not Arrayable responses. --- src/Outputs/Json.php | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/Outputs/Json.php b/src/Outputs/Json.php index 21b387e..e2f5714 100644 --- a/src/Outputs/Json.php +++ b/src/Outputs/Json.php @@ -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); }