Re: PHP's handling of BOM (byte order mark)
| From: | Stanislav Malyshev | Date: | Tue, 31 May 2016 00:40:16 +0000 |
| Subject: | Re: PHP's handling of BOM (byte order mark) | ||
| References: | 1 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-93643@lists.php.net to get a copy of this message | ||
Hi!
> 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?
The reason would be PHP does not know where surrounding output ends and
the code starts, beyond <?php. That means if there is some stuff in the
file before <?php, it would be output - and it's an intended behavior,
and so will happen with BOM too. Particular sequence of bytes being BOM
and whether it is desired or not depends on context, but PHP engine does
not have this context. Remember that pure HTML page is also a valid PHP
file.
--
Stas Malyshev
smalyshev@gmail.com