Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
Even a core test did this. Blargh!
Comment | File | Size | Author |
---|---|---|---|
#6 | 1716900_6.patch | 723 bytes | chx |
hook_exit_clarify.patch | 743 bytes | chx | |
Comments
Comment #1
Heine CreditAttribution: Heine commentedIf nothing breaks when you print, the "MUST" is a bit too strong. This hook can't send anything to the browser?
Comment #2
jhodgdonI 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?
Comment #3
chx CreditAttribution: chx commentedOutput 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.
Comment #4
jhodgdonGood 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.
Comment #5
catchYep fair enough. Committed/pushed to 8x, moving to 7.x for backport.
Comment #6
chx CreditAttribution: chx commentedIt applied with -p2 just fine.
Comment #7
chx CreditAttribution: chx commentedOh and it's 7.x
Comment #8
webchickCommitted and pushed to 7.x. Thanks!
One more time. :)
Comment #9
webchickx
Comment #10
mdupontCurrent D6 documentation says: "It is often used for page logging and printing out debugging information.". So, under D6 can we print in hook_exit()?
Comment #11
chx CreditAttribution: chx commentedI 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.