FAQ
Hey internals!

In a recent discussion on PHP Roundtable, we talked about the byte
order mark in php files. If you create a php file with the following:

<?php
header("X-foo: Bar");
echo "Foo!".PHP_EOL;

And save it as UTF-8 with BOM, interesting things happen depending on
the SAPI & configuration.

If you run it from the CLI you get an error:
PHP Warning: Cannot modify header information - headers already sent by (output started at %s:1) in %s on line %d
But it doesn't seem to return the BOM to std out (but I could be doing
this part wrong). If you run it from `php -S`, and load it in a
browser, the web server returns a code point \u{feff} as the first
code point of the response body.

BOM's should not be treated as characters and should not be sent to
the output. Is there any reason this should be considered the expected
behavior? If not, I'd like to create an RFC to change it. :)

Thanks,
Sammy Kaye Powers
sammyk.me

Search Discussions

Discussion Posts

Follow ups

Related Discussions

Discussion Navigation
viewthread | post
posts ‹ prev | 1 of 9 | next ›
Discussion Overview
groupphp-internals @
categoriesphp
postedMay 31, '16 at 12:33a
activeMay 31, '16 at 11:52a
posts9
users7
websitephp.net

People

Translate

site design / logo © 2021 Grokbase