|  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: 2016-12-31 00:21 UTC
Avg. Score:4.0 ± 1.0
Reproduced:16 of 16 (100.0%)
Same Version:1 (6.2%)
Same OS:11 (68.8%)
From: signe at cothlamadh dot net Assigned:
Status: Open Package: Scripting Engine problem
PHP Version: 5.2.6 OS: All
Private report: No CVE-ID: None
Have you experienced this issue?
Rate the importance of this bug to you:

 [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
PHP Copyright © 2001-2018 The PHP Group
All rights reserved.
Last updated: Sun Nov 19 01:31:42 2017 UTC