|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Request #45204 Comma should be a valid HEREDOC keyword suffix
Submitted: 2008-06-08 01:28 UTC Modified: 2018-04-13 20:03 UTC
Avg. Score:3.9 ± 1.0
Reproduced:17 of 17 (100.0%)
Same Version:1 (5.9%)
Same OS:12 (70.6%)
From: signe at cothlamadh dot net Assigned: nikic (profile)
Status: Closed Package: Scripting Engine problem
PHP Version: 5.2.6 OS: All
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: signe at cothlamadh dot net
New email:
PHP Version: OS:


 [2008-06-08 01:28 UTC] signe at cothlamadh dot net
Comma should be added to the allowable line suffixes for HEREDOC keywords.  The use of HEREDOC in an array becomes very ungainly because the keyword can not be terminated followed by a comma.

Currently the addition of a comma renders the scripting engine unable to recognize the keyword as being the terminator for the HEREDOC string and the rest of the script is absorbed resulting in an "syntax error, unexpected $end" E_PARSE_ERROR.

Reproduce code:
$foo = array(
    'blah' => <<<SQL
    'foo' => 'bar',
    'baz' => 'blat'

Expected result:
The comma should not prevent the HEREDOC string from being terminated, and should be a valid suffix, just like semi-colon is.

Actual result:
Parse error: syntax error, unexpected $end in test.php on line 16


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2016-12-31 00:21 UTC]
-Package: Feature/Change Request +Package: Scripting Engine problem
 [2018-03-15 18:17 UTC] lunakid at gmail dot com
Greetings from 2018, happy decennial! ;)
 [2018-04-13 20:03 UTC]
-Status: Open +Status: Closed -Assigned To: +Assigned To: nikic
 [2018-04-13 20:03 UTC]
This will be possible as part of, which just landed in master (PHP 7.3).
PHP Copyright © 2001-2018 The PHP Group
All rights reserved.
Last updated: Sun Oct 21 01:01:26 2018 UTC