|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #53672 Parser inconsistency for nowdoc/Heredoc vs. "normal" variable assignment at EOF
Submitted: 2011-01-06 16:36 UTC Modified: 2011-01-06 22:25 UTC
Avg. Score:4.0 ± 0.0
Reproduced:1 of 1 (100.0%)
Same Version:1 (100.0%)
Same OS:0 (0.0%)
From: dicugeorge1987 at yahoo dot com Assigned:
Status: Not a bug Package: Scripting Engine problem
PHP Version: 5.3.5 OS:
Private report: No CVE-ID: None
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
Block user comment
Status: Assign to:
Bug Type:
From: dicugeorge1987 at yahoo dot com
New email:
PHP Version: OS:


 [2011-01-06 16:36 UTC] dicugeorge1987 at yahoo dot com
Nowdocs and heredocs should also be LALR-reduced when EOF follows after T_END_HEREDOC, not only EOL

Test script:
$bar = <<<'EOD'
$foo is a variable

Expected result:
$foo is a variable

Actual result:
Parse error: syntax error, unexpected $end, expecting T_VARIABLE or T_END_HEREDOC or T_DOLLAR_OPEN_CURLY_BRACES or T_CURLY_OPEN in J:\webdev\apache\htdocs\salut2.php on line 4


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2011-01-06 16:46 UTC] flavius dot as at gmail dot com
Note that this will work though:
$foo = 'bar';
 [2011-01-06 16:48 UTC]
-Operating System: Windows 7 64bit +Operating System:
 [2011-01-06 22:25 UTC]
-Status: Open +Status: Bogus
 [2011-01-06 22:25 UTC]
Thank you for taking the time to write to us, but this is not
a bug. Please double-check the documentation available at and the instructions on how to report
a bug at

This is expected. The documentation states "The closing delimiter (possibly followed by a semicolon) must also be followed by a newline."
PHP Copyright © 2001-2019 The PHP Group
All rights reserved.
Last updated: Tue Mar 26 17:01:26 2019 UTC