Skip to content

(profiler doesn't show up) laravel.done event doesn't get fired for php-fcgi users #706

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

Merged
merged 5 commits into from
Aug 13, 2012

Conversation

vespakoen
Copy link
Contributor

Signed-off-by: Koen Schmeets k.schmeets@gmail.com

…done event has been fired for php-fastcgi users

Signed-off-by: Koen Schmeets <k.schmeets@gmail.com>
@crynobone
Copy link
Member

Wouldn't it be better to add Symfony\Component\HttpFoundation\LaravelResponse extends Symfony\Component\HttpFoundation\Response and only modify the send() method. By extending it, we can keep the original Symfony file unchanged and this helps during any upgrade of those components.

vespakoen added 2 commits May 24, 2012 11:49
Signed-off-by: Koen Schmeets <k.schmeets@gmail.com>
…thod

Signed-off-by: Koen Schmeets <k.schmeets@gmail.com>
@vespakoen
Copy link
Contributor Author

That was a good idea @crynobone, I hope this is more helpful.

@taylorotwell
Copy link
Member

Interesting. Anymore info on why it doesn't get called on fcgi?

@webbie
Copy link

webbie commented May 28, 2012

Looks like there is another issue with Symfony component:
http://forums.laravel.com/viewtopic.php?pid=8648

@vespakoen
Copy link
Contributor Author

So basically, in laravel/laravel.php, the laravel.done event gets fired after calling $response->send();,
The problem is that that method will stop the php (fcgi) process by calling fastcgi_finish_request(), and so the laravel.done never gets fired.

Calling laravel.done before sending the response would also solve this problem, but I am not sure of the importance of that.

My pull request will extend the Response class to stop the send() method from calling fastcgi_finish_request() and instead call it at a later time (after the laravel.done event is fired)

One way or another, we need to get this fixed =)

x

@vespakoen
Copy link
Contributor Author

Swapping laravel.done and $response->send(); would be the easiest solution.
In profiler.php you will have to change

//<?
Event::listen('laravel.done', function($response)
{
    echo Profiler::render($response);
});

to

//<?
Event::listen('laravel.done', function($response)
{
    $response->setContent($response->getContent().Profiler::render($response));
});

@djtarazona
Copy link

Just spent some time tracking done this issue as well. @vespakoen findings are correct.

@aleksblendwerk
Copy link

+1 for this, I had the same problem and this helped me. I also saw other people on #laravel experiencing this, as it keeps the Profiler from showing up.

@stefanneubig
Copy link
Contributor

+1

@darklow
Copy link

darklow commented Jun 12, 2012

Spent an hour debugging and wondering why profiler doesn't show, while came up to this situation on fastcgi_finish_request.
Hope there will be a fix or pull request accepted.
+1

@curana
Copy link

curana commented Jun 13, 2012

+1

We are facing the same issues.

A fix is highly appreciated!

@stefanneubig
Copy link
Contributor

@vespakoen

I tried to apply your fix but ran into this error:
Call to undefined method Laravel\Response::finish()

Shouldn't the laravel/response.php include the finish function?

After applying it like this, everything seems to work.

public function finish() {
    $this->foundation->finish();
}

@vespakoen
Copy link
Contributor Author

Thanks for pointing this out @stefanneubig it is fixed now

@taylorotwell
Copy link
Member

Can you update the change log to log the fix? :)

@vespakoen
Copy link
Contributor Author

I could, but It would very likely result in a conflict when merging this into the develop branch.
This pull-request is a month old (3.2 is the latest in the changelog)

I will add a commit that adds a comment to the finish() call, which should provide you with enough information to add to the changelog.

Is that allright? if not, I can make a new pull-request based off the latest develop branch.

@JoshZA
Copy link

JoshZA commented Jul 11, 2012

👍

@daylerees
Copy link
Contributor

Are we happy with this one @taylorotwell , must be a pretty annoying bug for php-fcgi users?

@stefanneubig
Copy link
Contributor

Just would like to bump this up.

taylorotwell added a commit that referenced this pull request Aug 13, 2012
(profiler doesn't show up) laravel.done event doesn't get fired for php-fcgi users
@taylorotwell taylorotwell merged commit 64605f2 into laravel:master Aug 13, 2012
@taylorotwell
Copy link
Member

thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.