note 79298 added to function.header

From: Date: Tue, 20 Nov 2007 04:33:49 +0000
Subject: note 79298 added to function.header
Groups: php.notes 
Request: Send a blank email to php-notes+get-132420@lists.php.net to get a copy of this message
I noticed a case where IE and Firefox behave a bit differently when you're using the header function in your scripts. It took me a few hours to find it, so I hope this post saves someone else from the same agony... When using the header function, it's documented quite clearly that you can't send output to the browser before sending the headers. I found out that you can, however, send BLANK SPACES before calling the header function and get different results depending on the browser. Apparently, IE will ignore/discard blank spaces and process headers sent using the header() function. Firefox does NOT ignore blank space and as a result, it will ignore subsequent headers when you attempt to send them via the header() function. In my case, Firefox was rendering a completely blank page - except for probably my spaces :-) I found the blank spaces tucked neatly between some line breaks at the end of an include file. So if your header() calls aren't working in Firefox but they are working in IE, it's probably time to start hunting for stray space characters! Cheers, Kevin ---- Server IP: 69.147.83.197 Probable Submitter: 71.164.133.167 ---- Manual Page -- http://www.php.net/manual/en/function.header.php Edit -- https://master.php.net/note/edit/79298 Del: integrated -- https://master.php.net/note/delete/79298/integrated Del: useless -- https://master.php.net/note/delete/79298/useless Del: bad code -- https://master.php.net/note/delete/79298/bad+code Del: spam -- https://master.php.net/note/delete/79298/spam Del: non-english -- https://master.php.net/note/delete/79298/non-english Del: in docs -- https://master.php.net/note/delete/79298/in+docs Del: other reasons-- https://master.php.net/note/delete/79298 Reject -- https://master.php.net/note/reject/79298 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#132420) next »