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

-- 
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to