Skip to content

[Laravel] Debugbar not reset after request #32

Open
@barryvdh

Description

@barryvdh

So from https://github.com/php-pm/php-pm

Laravel's debugger isn't working yet perfectly since it's still needed to reset some stuff after each request.

I'm assuming you mean my Laravel Debugbar?

If so, I've tried a couple of thing today with PHP-PM, with regards to not setting the config during the request, using different time sources (because the LARAVEL_START can't be re-defined) and not disabling after a request. This resulted in at least having a debugbar every time, but it was the same every time.

I saw the Symfony profiler has a similar issue (symfony/symfony#18244), so based on that, I made an initial implementation: php-debugbar/php-debugbar#268
That adds a reset() function to the debugbar + collectors, so they can be re-used.

Does that work for you guys? Or should I change something else?

Possible implementation could be:

    /**
     * @param \Illuminate\Contracts\Foundation\Application $app
     */
    public function postHandle($app)
    {
        $app = app();
        if ($app->resolved('debugbar')) {
            $app['debugbar']->reset();
        }
    }

(I used $app = app() because the parameter seems incorrect, it's an HttpKernel, not the Laravel app?)

Note: this isn't perfect yet, not all collectors are implementing the Resettable interface yet, and some collectors are added twice, but it should be a good starting point.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions