|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #74270 T_ENCAPSED_AND_WHITESPACE Error Implies an Error in the Interpreter
Submitted: 2017-03-19 00:11 UTC Modified: 2017-08-24 23:18 UTC
From: mark at manngo dot net Assigned:
Status: Open Package: Scripting Engine problem
PHP Version: Irrelevant OS: Any
Private report: No CVE-ID: None
Have you experienced this issue?
Rate the importance of this bug to you:

 [2017-03-19 00:11 UTC] mark at manngo dot net
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 ( 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.


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2017-08-24 23:18 UTC]
-Package: Strings related +Package: Scripting Engine problem
PHP Copyright © 2001-2020 The PHP Group
All rights reserved.
Last updated: Sat Dec 05 18:01:22 2020 UTC