php.net |  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
Votes:16
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
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.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: signe at cothlamadh dot net
New email:
PHP Version: OS:

 

 [2008-06-08 01:28 UTC] signe at cothlamadh dot net
Description:
------------
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:
---------------
<?php
$foo = array(
    'blah' => <<<SQL
        SELECT
            *
        FROM
            test
        WHERE
            RAND()
SQL,
    'foo' => 'bar',
    'baz' => 'blat'
);  
print_r($foo);
?>

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

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2016-12-31 00:21 UTC] cmb@php.net
-Package: Feature/Change Request +Package: Scripting Engine problem
 
PHP Copyright © 2001-2017 The PHP Group
All rights reserved.
Last updated: Sun Nov 19 01:31:42 2017 UTC