note 107930 deleted from function.header by tularis
| From: | tularis@php.net | Date: | Fri, 04 Apr 2014 11:18:40 +0000 |
| Subject: | note 107930 deleted from function.header by tularis | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-199128@lists.php.net to get a copy of this message | ||
Note Submitter: wong
----
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.