Closed AlliBalliBaba closed 4 months ago
I created another pull request which is just a one-line fix for this issue.
Would be cool if it gets merged. dump()
not working when debugging an HTML response can create a lot of confusion since the behavior is different from regular Laravel.
Thanks you. Let's see how the PR goes.
Looks like we're not making any changes here at this time sorry.
Octane Version
2.23
Laravel Version
10.43
PHP Version
8.3.2
What server type are you using?
Swoole
Server Version
5.1
Database Driver & Version
No response
Description
I've noticed that using
dump()
or@dump
does not work with Laravel Octane when we are dumping a response for a browser. TheSymfony\Component\VarDumper\VarDumper
seems to explicitly check ifPHP_SAPI
is 'cli' when dumping a variable. Since with Octane we're always in cli context, we're never using theHtmlDumper
. I found out that this issue can be circumvented by explicitly setting the handler for theVarDumper
like this when booting the app:Ideally Octane would already handle this itself, unless I'm missing something.
Steps To Reproduce
Start an octane server. Create a route that renders a blade view. Use
@dump($someVariable)
in the blade view. dump() will display nothing.Add the VarDumper::setHandler command from above into the boot() method of your AppServiceProvider. dump() will now properly display $someVariable in the browser