note 90160 added to function.headers-sent

From: Date: Wed, 08 Apr 2009 13:42:07 +0000
Subject: note 90160 added to function.headers-sent
Groups: php.notes 
Request: Send a blank email to php-notes+get-152961@lists.php.net to get a copy of this message
This is becoming annoying the amount of posts to try and describe the behaviour of headers Headers appear first in the data sent to the user's browser if headers have been called using the header() function but no data has been sent to the output buffer (using echo, readfile etc), then the headers are sent at the end of script execution otherwise they are sent when the buffer reaches it's limit and emptied simple this means that headers_sent() will return false if nothing is sent to the output buffer because the headers are being sent at the end of the script This is not a bug either, this is expected behaviour. Keeping headers until forced to send them out is a good idea because certain measures can be taken like prevention of meta injection etc (option in header() to replace headers that have not yet been sent) besides, headers_sent() is good for when you try and send headers but the output buffer has already been emptied (in cases of php error handling for example). Obviously if the buffer has emtpied, sending headers won't work. ---- Server IP: 92.48.74.199 Probable Submitter: 91.84.158.217 ---- Manual Page -- http://www.php.net/manual/en/function.headers-sent.php Edit -- https://master.php.net/note/edit/90160 Del: integrated -- https://master.php.net/note/delete/90160/integrated Del: useless -- https://master.php.net/note/delete/90160/useless Del: bad code -- https://master.php.net/note/delete/90160/bad+code Del: spam -- https://master.php.net/note/delete/90160/spam Del: non-english -- https://master.php.net/note/delete/90160/non-english Del: in docs -- https://master.php.net/note/delete/90160/in+docs Del: other reasons-- https://master.php.net/note/delete/90160 Reject -- https://master.php.net/note/reject/90160 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#152961) next »