laravel / octane

Supercharge your Laravel application's performance.
https://laravel.com/docs/octane
MIT License
3.73k stars 289 forks source link

Fix #838: The Symfony VarDumper dumps correctly when in HTML context #855

Closed AlliBalliBaba closed 4 months ago

AlliBalliBaba commented 4 months ago

Fixes #838

When using dump() or @dump in Octane nothing is displayed when we're in the context of a request. One would expect a dump in form of HTML like it's the case in regular Laravel

This commit fixes the Symfony VarDumper so it detects whether we're in console or not by using app()->runningInConsole() instead of looking at the value of PHP_SAPI.

The test I wrote checks that Blade explicity renders a dumped variable. It is unfortunate that I have to explicitly set $_ENV['APP_RUNNING_IN_CONSOLE'] in the test and unset it afterwards. It probably would be better to generally mock app()->runningInConsole() so it returns false for all tests. In the scope of this fix I did not want to touch other tests though.

Cheers

taylorotwell commented 4 months ago

Thanks for your pull request to Laravel!

Unfortunately, I'm going to delay merging this code for now. To preserve our ability to adequately maintain the framework, we need to be very careful regarding the amount of code we include.

If possible, please consider releasing your code as a package so that the community can still take advantage of your contributions!

If you feel absolutely certain that this code corrects a bug in the framework, please "@" mention me in a follow-up comment with further explanation so that GitHub will send me a notification of your response.