We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent a67bd42 commit 9dbd6b1Copy full SHA for 9dbd6b1
src/LaravelDebugbar.php
@@ -923,17 +923,19 @@ protected function isJsonResponse(Response $response)
923
return true;
924
}
925
926
- try {
927
- $content = $response->getContent();
+ $content = $response->getContent();
928
929
- if (is_string($content)) {
930
- $content = json_decode($content, true);
+ if (is_string($content)) {
+ if (function_exists('json_validate')) {
+ return json_validate($content);
931
932
933
- if (is_array($content)) {
934
- return true;
935
- }
936
- } catch (Exception $e) {
+ // PHP <= 8.2 check
+ json_decode($content, true);
+
+ return json_last_error() === JSON_ERROR_NONE;
937
+ } elseif (is_array($content)) {
938
+ return true;
939
940
941
return false;
0 commit comments