note 107930 added to function.header

From: Date: Thu, 15 Mar 2012 10:15:47 +0000
Subject: note 107930 added to function.header
Groups: php.notes 
Request: Send a blank email to php-notes+get-186678@lists.php.net to get a copy of this message
I had to battle with the "header already sent" problem recently. I read the manual and understand "Do not send spaces or empty lines before header() is called" and made sure it wasn't happening in my code. But still have "header already sent" problem. It turned out to be the UTF BOM (byte order mark) problem pete mentioned in 2004. It's probably worth to mention it again, maybe put this in the official manual. Those BOM bytes are not visible to normal text editor and caused me a lot of pain trying to figure out what went wrong. In short, if you are sure your code didn't send any strings before header() is called but still have "header already sent" problem, it is probably because your source code is saved using UTF BOM. To verify that, open the source code in a binary editor, you should see the first 3 bytes are EF BB BF. They should be deleted for the source code to work. The bug has been logged under https://bugs.php.net/bug.php?id=22108. ---- Server IP: 69.147.83.197 Probable Submitter: 123.243.177.103 ---- Manual Page -- http://www.php.net/manual/en/function.header.php Edit -- https://master.php.net/note/edit/107930 Del: integrated -- https://master.php.net/note/delete/107930/integrated Del: useless -- https://master.php.net/note/delete/107930/useless Del: bad code -- https://master.php.net/note/delete/107930/bad+code Del: spam -- https://master.php.net/note/delete/107930/spam Del: non-english -- https://master.php.net/note/delete/107930/non-english Del: in docs -- https://master.php.net/note/delete/107930/in+docs Del: other reasons-- https://master.php.net/note/delete/107930 Reject -- https://master.php.net/note/reject/107930 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#186678) next »