Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Crashes if the response is not an object #25

Open
alex-muntean opened this issue Feb 28, 2020 · 1 comment
Open

Crashes if the response is not an object #25

alex-muntean opened this issue Feb 28, 2020 · 1 comment

Comments

@alex-muntean
Copy link

alex-muntean commented Feb 28, 2020

First, thanks for the work on this package.

Trying to return a simple response with "Unauthorized"

return response()->json("Unauthorized", 401)

The variable $data on src/Debugger.php line 117 will then be "Unauthorized".

This will cause a crash on line 123 on the same function when attempting to add the debugging details to the $data variable which is a string, not an object.

$data->{$this->responseKey} = $this->storage->getData();

This can be easily fixed if a check is added before the information is added to $data variable.

L.E.: I know there is an workaround to change response to:

return response()->json(["message" => "Unauthorized"], 401)

but would be nice if you could still return something without wrapping it and i would like to not return debug info when an user is not authenticated.

Maybe another idea would be to be able to disable logging on the fly, something like

Debugger::disable();

Version: 3.5.0.
Laravel version: 6.17.1

Please let me know if you need additional information.

@baldonhc
Copy link

Any fix on this? I don't want to disable debugbar but this error is holding me. :(

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants