Req #45204 [Opn->Csd]: Comma should be a valid HEREDOC keyword suffix

From: Date: Fri, 13 Apr 2018 20:03:13 +0000
Subject: Req #45204 [Opn->Csd]: Comma should be a valid HEREDOC keyword suffix
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-214739@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 Updated by: nikic@php.net Reported by: signe at cothlamadh dot net Summary: Comma should be a valid HEREDOC keyword suffix -Status: Open +Status: Closed Type: Feature/Change Request Package: Scripting Engine problem Operating System: All PHP Version: 5.2.6 -Assigned To: +Assigned To: nikic Block user comment: N Private report: N New Comment: This will be possible as part of https://wiki.php.net/rfc/flexible_heredoc_nowdoc_syntaxes, which just landed in master (PHP 7.3). Previous Comments: ------------------------------------------------------------------------ [2018-03-15 18:17:31] lunakid at gmail dot com Greetings from 2018, happy decennial! ;) ------------------------------------------------------------------------ [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

« previous php.bugs (#214739) next »