Req #45204 [Com]: Comma should be a valid HEREDOC keyword suffix
| From: | lunakid at gmail dot com | Date: | Thu, 15 Mar 2018 18:17:32 +0000 |
| Subject: | Req #45204 [Com]: Comma should be a valid HEREDOC keyword suffix | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-214377@lists.php.net to get a copy of this message | ||
Edit report at https://bugs.php.net/bug.php?id=45204&edit=1
ID: 45204
Comment by: lunakid at gmail dot com
Reported by: signe at cothlamadh dot net
Summary: Comma should be a valid HEREDOC keyword suffix
Status: Open
Type: Feature/Change Request
Package: Scripting Engine problem
Operating System: All
PHP Version: 5.2.6
Block user comment: N
Private report: N
New Comment:
Greetings from 2018, happy decennial! ;)
Previous Comments:
------------------------------------------------------------------------
[2008-06-08 01:28:24] 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
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=45204&edit=1