Bug #74270 [Opn->Nab]: T_ENCAPSED_AND_WHITESPACE Error Implies an Error in the Interpreter
| From: | cmb@php.net | Date: | Fri, 15 Jan 2021 15:29:26 +0000 |
| Subject: | Bug #74270 [Opn->Nab]: T_ENCAPSED_AND_WHITESPACE Error Implies an Error in the Interpreter | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-231587@lists.php.net to get a copy of this message | ||
Edit report at https://bugs.php.net/bug.php?id=74270&edit=1
ID: 74270
Updated by: cmb@php.net
Reported by: mark at manngo dot net
Summary: T_ENCAPSED_AND_WHITESPACE Error Implies an Error in
the Interpreter
-Status: Open
+Status: Not a bug
Type: Bug
Package: Scripting Engine problem
Operating System: Any
PHP Version: Irrelevant
-Assigned To:
+Assigned To: cmb
Block user comment: N
Private report: N
New Comment:
The current behavior is documented in the PHP manual[1], so this
is not a bug. Also note that the manual states:
| For anything more complex, you should use the complex syntax.
If you feel strongly that the existing behavior should be changed,
please pursue the RFC process[2].
[1] <https://www.php.net/manual/en/language.types.string.php#language.types.string.parsing>
[2] <https://wiki.php.net/rfc/howto>
Previous Comments:
------------------------------------------------------------------------
[2017-03-19 00:11:08] mark at manngo dot net
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 this bug report at https://bugs.php.net/bug.php?id=74270&edit=1