We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 825be2c commit 8a8138aCopy full SHA for 8a8138a
src/LaravelDebugbar.php
@@ -872,17 +872,15 @@ protected function isJsonResponse(Response $response)
872
return true;
873
}
874
875
- try {
876
- $content = $response->getContent();
+ $content = $response->getContent();
877
878
- if (is_string($content)) {
879
- $content = json_decode($content, true);
880
- }
+ if (function_exists('json_validate')) {
+ return json_validate($content);
+ } else if (is_string($content)) {
+ // PHP <= 8.2 check
881
+ json_decode($content, true);
882
- if (is_array($content)) {
883
- return true;
884
885
- } catch (Exception $e) {
+ return json_last_error() === JSON_ERROR_NONE;
886
887
888
return false;
0 commit comments