|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #76608 Heredoc end label should not require an additional trailing character
Submitted: 2018-07-11 01:01 UTC Modified: 2018-07-11 17:57 UTC
Avg. Score:1.0 ± 0.0
Reproduced:0 of 1 (0.0%)
From: mattacosta at gmail dot com Assigned:
Status: Verified Package: Scripting Engine problem
PHP Version: 7.2.7 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: mattacosta at gmail dot com
New email:
PHP Version: OS:


 [2018-07-11 01:01 UTC] mattacosta at gmail dot com
If a perfectly valid heredoc is not followed by an additional character, the reported error states that an end label was expected, even though it was present. 

This means that instead of removing the requirement for a trailing newline, it was in fact replaced by a requirement for any trailing character.

Test script:
// No trailing line.
echo <<<LABEL
  hello world

Expected result:
Parse error: syntax error, unexpected end of file, expecting ',' or ';'

Actual result:
Parse error: syntax error, unexpected end of file, expecting variable (T_VARIABLE) or heredoc end (T_END_HEREDOC) or ${ (T_DOLLAR_OPEN_CURLY_BRACES) or {$ (T_CURLY_OPEN)


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2018-07-11 14:55 UTC]
-Status: Open +Status: Verified -PHP Version: 7.3.0alpha3 +PHP Version: 7.2.7
 [2018-07-11 14:55 UTC]
This does not appear particularly related to PHP 7.3, see
 [2018-07-11 17:57 UTC] mattacosta at gmail dot com
That error appears to be correct in previous versions though. Without the required  line break, the label would be part of the text instead, so it would make sense to expect T_END_HEREDOC.
PHP Copyright © 2001-2019 The PHP Group
All rights reserved.
Last updated: Fri Feb 22 13:01:25 2019 UTC