Download & Extend

Clarify why hook_exit must not print

Project:Drupal core
Version:6.x-dev
Component:documentation
Category:task
Priority:normal
Assigned:chx
Status:closed (fixed)
Issue tags:needs backport to D6

Issue Summary

Even a core test did this. Blargh!

AttachmentSizeStatusTest resultOperations
hook_exit_clarify.patch743 bytesIdlePASSED: [[SimpleTest]]: [MySQL] 39,830 pass(es).View details

Comments

#1

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

#2

Title:Clarify why hook_exist must not print» Clarify why hook_exit must not print

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?

#3

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.

#4

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.

#5

Status:reviewed & tested by the community» patch (to be ported)

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

#6

Status:patch (to be ported)» reviewed & tested by the community

It applied with -p2 just fine.

AttachmentSizeStatusTest resultOperations
1716900_6.patch723 bytesIdlePASSED: [[SimpleTest]]: [MySQL] 39,356 pass(es).View details

#7

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

Oh and it's 7.x

#8

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. :)

#9

Issue tags:-needs backport to D7

x

#10

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()?

#11

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.

#12

Status:fixed» closed (fixed)

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

nobody click here