Edit report at https://bugs.php.net/bug.php?id=63423&edit=1
ID: 63423 Updated by: ras...@php.net Reported by: code at henrik-gebauer dot de Summary: short open tag should be distinguished from other processing instructions -Status: Open +Status: Duplicate Type: Feature/Change Request Package: *Compile Issues Operating System: all PHP Version: Irrelevant Block user comment: N Private report: N New Comment: This is already implemented in PHP 5.4. <?= is always enabled so you can turn short_tags off and you get the behaviour you are asking for. Previous Comments: ------------------------------------------------------------------------ [2012-11-02 23:29:03] code at henrik-gebauer dot de Description: ------------ The short open tag is very useful for readable templates: <?=$var?>, <? foreach ($array as $v): ?>, <? foreachend; ?> etc. But on the other hand it interferes with other processing instructions like <?xml version="1.0" encoding="utf-8"?> or <?xml-stylesheet href="style.css" type="text/css" media="all" ?> So you have to use <?="<?"?>xml version="1.0" encoding="utf-8"?> or something similar in your template which makes it less readable. The compiler should distinguish between a short PHP tag and other processing instructions. If the compiler is not sure if "<? something" is PHP code or not it should report an error as before. Test script: --------------- <?xml version="1.0" encoding="utf-8"?> <?="hello world\n";?> <?php echo "hello world\n"; ?> Expected result: ---------------- <?xml version="1.0" encoding="utf-8"?> hello world hello world Actual result: -------------- Parse error: syntax error, unexpected 'version' (T_STRING) in ... on line 1 ------------------------------------------------------------------------ -- Edit this bug report at https://bugs.php.net/bug.php?id=63423&edit=1