Even a core test did this. Blargh!

CommentFileSizeAuthor
#6 1716900_6.patch723 byteschx
hook_exit_clarify.patch743 byteschx
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

Heine’s picture

If nothing breaks when you print, the "MUST" is a bit too strong. This hook can't send anything to the browser?

jhodgdon’s picture

Title: Clarify why hook_exist must not print » Clarify why hook_exit must not print
Issue tags: +Needs backport to D6, +Needs backport to D7

I think this change is good -- the hook docs already said you can't print, and this just clarifies why... but that is a good question. What does "already sent to the browser" mean really? I thought the output would only be sent to the browser when exit() is called in the PHP code?

chx’s picture

Output is also sent on flush(). While D6 and D7 core does not flush, D8 does and a contrib might earlier. Also, FPM has fastcgi_finish_request command which (surprise!) finishes the request :) ie closes the output and D8 calls that if it can.

jhodgdon’s picture

Status: Needs review » Reviewed & tested by the community

Good point. I think this patch is a good idea then. I'll leave it for a few days at RTBC before I do any committing of it though (which might turn into a week if one of the other committers doesn't grab it, as I'm traveling)... just in case there are dissenting opinions.

catch’s picture

Status: Reviewed & tested by the community » Patch (to be ported)

Yep fair enough. Committed/pushed to 8x, moving to 7.x for backport.

chx’s picture

Status: Patch (to be ported) » Reviewed & tested by the community
FileSize
723 bytes

It applied with -p2 just fine.

chx’s picture

Version: 8.x-dev » 7.x-dev

Oh and it's 7.x

webchick’s picture

Version: 7.x-dev » 6.x-dev
Status: Reviewed & tested by the community » Patch (to be ported)

Committed and pushed to 7.x. Thanks!

One more time. :)

webchick’s picture

Issue tags: -Needs backport to D7

x

mdupont’s picture

Current D6 documentation says: "It is often used for page logging and printing out debugging information.". So, under D6 can we print in hook_exit()?

chx’s picture

Status: Patch (to be ported) » Fixed

I am not 100% whether enhancing D6 documentation is anyone's priority at this stage. Nor I believe that committing this would make anyone change their code and finally I have no idea what to do under D6 instead of hook_exit.

Automatically closed -- issue fixed for 2 weeks with no activity.