Req #63423 [NEW]: short open tag should be distinguished from other processing instructions
| From: | code at henrik-gebauer dot de | Date: | Fri, 02 Nov 2012 23:29:03 +0000 |
| Subject: | Req #63423 [NEW]: short open tag should be distinguished from other processing instructions | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-174492@lists.php.net to get a copy of this message | ||
From: code at henrik-gebauer dot de
Operating system: all
PHP version: Irrelevant
Package: *Compile Issues
Bug Type: Feature/Change Request
Bug description:short open tag should be distinguished from other processing instructions
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 bug report at https://bugs.php.net/bug.php?id=63423&edit=1
--
Try a snapshot (PHP 5.4): https://bugs.php.net/fix.php?id=63423&r=trysnapshot54
Try a snapshot (PHP 5.3): https://bugs.php.net/fix.php?id=63423&r=trysnapshot53
Try a snapshot (trunk): https://bugs.php.net/fix.php?id=63423&r=trysnapshottrunk
Fixed in SVN: https://bugs.php.net/fix.php?id=63423&r=fixed
Fixed in release: https://bugs.php.net/fix.php?id=63423&r=alreadyfixed
Need backtrace: https://bugs.php.net/fix.php?id=63423&r=needtrace
Need Reproduce Script: https://bugs.php.net/fix.php?id=63423&r=needscript
Try newer version: https://bugs.php.net/fix.php?id=63423&r=oldversion
Not developer issue: https://bugs.php.net/fix.php?id=63423&r=support
Expected behavior: https://bugs.php.net/fix.php?id=63423&r=notwrong
Not enough info: https://bugs.php.net/fix.php?id=63423&r=notenoughinfo
Submitted twice: https://bugs.php.net/fix.php?id=63423&r=submittedtwice
register_globals: https://bugs.php.net/fix.php?id=63423&r=globals
PHP 4 support discontinued: https://bugs.php.net/fix.php?id=63423&r=php4
Daylight Savings: https://bugs.php.net/fix.php?id=63423&r=dst
IIS Stability: https://bugs.php.net/fix.php?id=63423&r=isapi
Install GNU Sed: https://bugs.php.net/fix.php?id=63423&r=gnused
Floating point limitations: https://bugs.php.net/fix.php?id=63423&r=float
No Zend Extensions: https://bugs.php.net/fix.php?id=63423&r=nozend
MySQL Configuration Error: https://bugs.php.net/fix.php?id=63423&r=mysqlcfg