-
Notifications
You must be signed in to change notification settings - Fork 72
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
[Laravel] Debugbar not reset after request #32
Comments
Yes, exactly. In Laravel's Bootstrap class is I have not much experiences with Laravel, but I guess that should do the trick for the moment so people can use PHP-PM also with Laravel completely. Maybe @taylorotwell has more insights. |
I haven't really tested yet, but wouldn't it be easier to reset the Container or something? Don't a lot of classes have this problem, or is that kind of intended/the purpose? |
Resetting the container is a drastically performance decreasement which makes php-pm almost useless. Symfony's HttpKernel has a terminate event, which should be used to clean stuff up. However, since PHP normally "cleans" everything up after each requests, almost nobody used the event. Nonetheless this is the way to go. |
So should I terminate in my Debugbar middleware then? |
I don't know what you mean. You need to reset stuff that needs to be resetted in the terminate event. |
I meant that if I put the cleanup, in the middleware from the debugbar, we don't need to change the |
Yes, if you have the necessary events in your middleware, then you should place the cleanup there. |
@barryvdh any toughs on the current state of this? |
Yeah not really, haven't looked in it much because I haven't found a use-case yet. Does it work with Laravel out-of-the-box yet? |
@barryvdh Just tested, yes, looks like working really well, only that debugbar settings are ignored and it only gets activated if php-pm Thanks! |
Sorry, it's not. It's actually loading, but showing repetively the first request results intead of refreshing. |
|
So from https://github.com/php-pm/php-pm
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: maximebf/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:
(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.
The text was updated successfully, but these errors were encountered: