Bug #62175 [NEW]: single quotes vs double quotes give different results with token_get_all
| From: | iam4webwork at hotmail dot com | Date: | Tue, 29 May 2012 00:23:26 +0000 |
| Subject: | Bug #62175 [NEW]: single quotes vs double quotes give different results with token_get_all | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-170882@lists.php.net to get a copy of this message | ||
From: iam4webwork at hotmail dot com
Operating system:
PHP version: Irrelevant
Package: Scripting Engine problem
Bug Type: Bug
Bug description:single quotes vs double quotes give different results with token_get_all
Description:
------------
$tokens = token_get_all('<?php "{$bar}";');
vs.
$tokens = token_get_all("<?php \"{$bar}\";");
Test script:
---------------
$tokens = token_get_all('<?php "{$bar}";');
foreach ($tokens as $token) if (is_array($token)) print
token_name($token[0]) ."\n";
echo '<P>';
$bar = 'bar'; // to avoid error notice
$tokens = token_get_all("<?php \"{$bar}\";");
foreach ($tokens as $token) if (is_array($token)) print
token_name($token[0]) ."\n";
Expected result:
----------------
T_OPEN_TAG
T_CURLY_OPEN
T_VARIABLE
T_OPEN_TAG
T_CURLY_OPEN
T_VARIABLE
Actual result:
--------------
T_OPEN_TAG
T_CURLY_OPEN
T_VARIABLE
in the 2nd case got this instead:
T_OPEN_TAG
T_CONSTANT_ENCAPSED_STRING
--
Edit bug report at https://bugs.php.net/bug.php?id=62175&edit=1
--
Try a snapshot (PHP 5.4): https://bugs.php.net/fix.php?id=62175&r=trysnapshot54
Try a snapshot (PHP 5.3): https://bugs.php.net/fix.php?id=62175&r=trysnapshot53
Try a snapshot (trunk): https://bugs.php.net/fix.php?id=62175&r=trysnapshottrunk
Fixed in SVN: https://bugs.php.net/fix.php?id=62175&r=fixed
Fixed in SVN and need be documented: https://bugs.php.net/fix.php?id=62175&r=needdocs
Fixed in release: https://bugs.php.net/fix.php?id=62175&r=alreadyfixed
Need backtrace: https://bugs.php.net/fix.php?id=62175&r=needtrace
Need Reproduce Script: https://bugs.php.net/fix.php?id=62175&r=needscript
Try newer version: https://bugs.php.net/fix.php?id=62175&r=oldversion
Not developer issue: https://bugs.php.net/fix.php?id=62175&r=support
Expected behavior: https://bugs.php.net/fix.php?id=62175&r=notwrong
Not enough info: https://bugs.php.net/fix.php?id=62175&r=notenoughinfo
Submitted twice: https://bugs.php.net/fix.php?id=62175&r=submittedtwice
register_globals: https://bugs.php.net/fix.php?id=62175&r=globals
PHP 4 support discontinued: https://bugs.php.net/fix.php?id=62175&r=php4
Daylight Savings: https://bugs.php.net/fix.php?id=62175&r=dst
IIS Stability: https://bugs.php.net/fix.php?id=62175&r=isapi
Install GNU Sed: https://bugs.php.net/fix.php?id=62175&r=gnused
Floating point limitations: https://bugs.php.net/fix.php?id=62175&r=float
No Zend Extensions: https://bugs.php.net/fix.php?id=62175&r=nozend
MySQL Configuration Error: https://bugs.php.net/fix.php?id=62175&r=mysqlcfg