laravel-debugbar
laravel-debugbar copied to clipboard
debugbar not show when not start session and use cookie as session driver
step to reproduce
- create fresh laravel from command
composer create-project laravel/laravel debugbar-cookie
- install laravel debug bar
composer require barryvdh/laravel-debugbar --dev
- disable session by edit
app/Http/Kernel.php
and comment these 3 lines in web middleware groups
// \Illuminate\Session\Middleware\StartSession::class,
// \Illuminate\View\Middleware\ShareErrorsFromSession::class,
// \App\Http\Middleware\VerifyCsrfToken::class,
- run php artisan serve. and go to home page. at this step you can see in debugbar that it create new _token everytime
- edit .env change
SESSION_DRIVER
tocookie
- go to homepage again. you can not find any debugbar anymore. and in logs you will see something like
[2022-08-16 10:30:16] local.ERROR: Debugbar exception: Attempt to read property "cookies" on null
i think the problem is this function always want to start session. i not sure why it should start session everytime? https://github.com/barryvdh/laravel-debugbar/blob/09dc915ae3ab0b96ae78c2bfc369fac38d0b4162/src/SymfonyHttpDriver.php#L39-L46
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. If this issue is still present on the latest version of this library on supported Laravel versions, please let us know by replying to this issue so we can investigate further. Thank you for your contribution! Apologies for any delayed response on our side.
I am experiencing this as well. Since the SessionMiddleware is not running, the request is never set into the session handler, and that is what is throwing the exception.