php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #41952 Problem with PHP6 and Byte Order Mark
Submitted: 2007-07-10 17:02 UTC Modified: 2007-07-11 08:34 UTC
From: hedvall at gmail dot com Assigned:
Status: Not a bug Package: Compile Warning
PHP Version: 6CVS-2007-07-10 (snap) OS: Win2k SP4
Private report: No CVE-ID: None
 [2007-07-10 17:02 UTC] hedvall at gmail dot com
Description:
------------
After upgrading to the latest PHP6 build from 6CVS-2007-06-21 the compiler no longer accepts the UTF-8 BOM (Byte Order Mark) to be sent before the headers. It might be correct to not send the headers after any other output but it hasn't caused any trouble with any newer browser on any platform (win, mac, linux).
I always remove the BOM before the sites go live but when developing it's easier to leave it there until the page is finished.
This is not a duplicate of 22108.

Reproduce code:
---------------
<?php
header("HTTP/1.0 404 Not Found");
?>

Expected result:
----------------
404 header sent without warning

Actual result:
--------------
Warning: Cannot modify header information - headers already sent by (output started at [...]/header.php:1) in [...]/header.php on line 2

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2007-07-11 07:27 UTC] tony2001@php.net
Thank you for taking the time to write to us, but this is not
a bug. Please double-check the documentation available at
http://www.php.net/manual/ and the instructions on how to report
a bug at http://bugs.php.net/how-to-report.php


 [2007-07-11 08:34 UTC] hedvall at gmail dot com
Alright, this might not be a bug, but it worked in older versions and the one of the comments on bug http://bugs.php.net/bug.php?id=22108 said that the BOM won't be sent at all with PHP6 along with the Unicode support. But yes, the documentation says that no header can't be sent after any output, but this did work previously because most browsers ignore the BOM completely, even if it's sent in the middle of the header block.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Thu Mar 28 17:01:29 2024 UTC