Bug #74312 [Com]: Filter BOMs out of PHP output
[email protected] ("furun at arcor dot de")
| Newsgroups | php.bugs |
|---|---|
| Message-ID | <[email protected]> |
Edit report at https://bugs.php.net/bug.php?id=74312&edit=1 ID: 74312 Comment by: furun at arcor dot de Reported by: furun at arcor dot de Summary: Filter BOMs out of PHP output Status: Open Type: Bug Package: Unicode Engine related Operating System: Win7 PHP Version: 7.0.17 Block user comment: N Private report: N New Comment: I understand, but should this be a dogma in this case? In practice, a file has to be opened to process it, or in other words, php care about opening a source file to check if there is <?php code. The file handler could make a exception if a php-file is processed? I can not think of any practical use of this behafior, if a BOM must be send to output, it can be done in code... So it would be real-live solution. And dependent of the editor software behavior, no BOM can cause issues too. So would be nice if a BOM can be present in a PHP file, and be ignored in the output. I speculate it is a common and often appearing issue, so maybe deserves a exceptional treatment. (Thanks for your VERY quick response, this was the fastest ever ;-) (And sorry if a ask more, i am not a deep PHP-Dev insider.) Previous Comments: ------------------------------------------------------------------------ [2017-03-25 21:08:18] spam2 at rhsoft dot net This is simply not possible because the BOM is not part of the php output at all - php don't and must not care about anything outside of <?php ?> ------------------------------------------------------------------------ [2017-03-25 21:01:59] furun at arcor dot de Description: ------------ PHP send the BOM (before the tag "<?php") to the output. This is a source for some very strange buggy behavior, which are sometimes very difficult to find, because a developer searches errors first in the code it self and not in a mostly invisible BOM. (I searched a "bug" in a image creating script for long time, before i found the BOM-Bug in a third party plugin far away from the "buggy code". The common "Headers already sent" error caused by the BOM are still confusing, but easier to find then a corrupted binary file.) I would suggest that PHP filters every BOM from PHP output. (Or is there any reason not to do so i not know of?) Test script: --------------- (Use any file with BOM) ------------------------------------------------------------------------ -- Edit this bug report at https://bugs.php.net/bug.php?id=74312&edit=1