We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent a67bd42 commit 1977d73Copy full SHA for 1977d73
src/LaravelDebugbar.php
@@ -923,17 +923,17 @@ 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);
931
- }
+ if (function_exists('json_validate')) {
+ return json_validate($content);
+ } elseif (is_string($content)) {
+ // PHP <= 8.2 check
932
+ json_decode($content, true);
933
- if (is_array($content)) {
934
- return true;
935
936
- } catch (Exception $e) {
+ return json_last_error() === JSON_ERROR_NONE;
+ } elseif (is_array($content)) {
+ return true;
937
938
939
return false;
0 commit comments