Update: It seems there's an outdated plugin for doing what I want to do:
https://community.elgg.org/plugins/550231
It seems very small and simple to update. Perhaps I can revive it?
There are no characters (nor even a newline or whitespaces) allowed before <?php. If there is any content before, how should it be handled correctly? It's won't get interpreted as php code (that's only the case after <?php). Instead of handling it as php code it will be interpreted as content to be displayed somewhere and this can result in unpredictable problems. Therefore just don't put anything in php files before <?php.
The Byte Order Marks (BOMs) are a special case of characters before <?php. The BOMs are non-printable characters. So, you won't see them in an editor. But if they do exist at the beginning of the file (due to saving the file with a BOM encoding) you will get the same problems you would have when putting any visible characters before the <?php. Therefore, you always need to save your files without BOMs, e.g. with "UTF-8 without BOMs" encoding.
Great, thank you! This is good information to have; perhaps it could go into the Elgg documentation somewhere?
info@elgg.org
Security issues should be reported to security@elgg.org!
©2014 the Elgg Foundation
Elgg is a registered trademark of Thematic Networks.
Cover image by Raül Utrera is used under Creative Commons license.
Icons by Flaticon and FontAwesome.