Bug #74270 [NEW]: T_ENCAPSED_AND_WHITESPACE Error Implies an Error in the Interpreter
| From: | mark at manngo dot net | Date: | Sun, 19 Mar 2017 00:11:11 +0000 |
| Subject: | Bug #74270 [NEW]: T_ENCAPSED_AND_WHITESPACE Error Implies an Error in the Interpreter | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-207928@lists.php.net to get a copy of this message | ||
From: mark at manngo dot net
Operating system: Any
PHP version: Irrelevant
Package: Strings related
Bug Type: Bug
Bug description:T_ENCAPSED_AND_WHITESPACE Error Implies an Error in the Interpreter
Description:
------------
It is a well know issue that a string like "Something $array['key'] etc"
will produce the notorious T_ENCAPSED_AND_WHITESPACE error. The only way
around it is to remove the inner quotes or to enclose the variable
expression in braces.
Apart from the fact that the error code is unintelligible to most normal
human beings, the source of the error indicates a mis-interpretation in
the handling of the string.
I have sought the advice of Eric Wastl, who has added it to his list
(http://phpsadness.com/sad/54). In his email to me:
âAfter tearing this one apart for a while, I'm pretty sure it's an
edgecase bug in the tokenizer. It's existed for a long time, and it's
still there in 7.10.â
Adding my own interpretation, it appears that having a real string
literal inside a string literal appears to be causing a problem, and
PHPâs flexibility in handling single or double quotes appear to be its
undoing at this point. But thatâs just looking at the problem from the
outside.
I cannot see how producing this type of error is intended behaviour,
since it is a natural expectation that the above string is correct.
I therefore submit it as a bug.
Please note that although the bug database contains a number of
references to T_ENCAPSED_AND_WHITESPACE, none actually submit the error
as a bug in PHP, and none appear to be resolved.
--
Edit bug report at https://bugs.php.net/bug.php?id=74270&edit=1
--
Try a snapshot (PHP 5.4): https://bugs.php.net/fix.php?id=74270&r=trysnapshot54
Try a snapshot (PHP 5.5): https://bugs.php.net/fix.php?id=74270&r=trysnapshot55
Try a snapshot (trunk): https://bugs.php.net/fix.php?id=74270&r=trysnapshottrunk
Fixed in SVN: https://bugs.php.net/fix.php?id=74270&r=fixed
Fixed in release: https://bugs.php.net/fix.php?id=74270&r=alreadyfixed
Need backtrace: https://bugs.php.net/fix.php?id=74270&r=needtrace
Need Reproduce Script: https://bugs.php.net/fix.php?id=74270&r=needscript
Try newer version: https://bugs.php.net/fix.php?id=74270&r=oldversion
Not developer issue: https://bugs.php.net/fix.php?id=74270&r=support
Expected behavior: https://bugs.php.net/fix.php?id=74270&r=notwrong
Not enough info: https://bugs.php.net/fix.php?id=74270&r=notenoughinfo
Submitted twice: https://bugs.php.net/fix.php?id=74270&r=submittedtwice
register_globals: https://bugs.php.net/fix.php?id=74270&r=globals
PHP 4 support discontinued: https://bugs.php.net/fix.php?id=74270&r=php4
Daylight Savings: https://bugs.php.net/fix.php?id=74270&r=dst
IIS Stability: https://bugs.php.net/fix.php?id=74270&r=isapi
Install GNU Sed: https://bugs.php.net/fix.php?id=74270&r=gnused
Floating point limitations: https://bugs.php.net/fix.php?id=74270&r=float
No Zend Extensions: https://bugs.php.net/fix.php?id=74270&r=nozend
MySQL Configuration Error: https://bugs.php.net/fix.php?id=74270&r=mysqlcfg