Bug #78441 [PATCH]: Parse error due to heredoc identifier followed by digit

From: Date: Wed, 21 Aug 2019 17:24:47 +0000
Subject: Bug #78441 [PATCH]: Parse error due to heredoc identifier followed by digit
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-222357@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=78441&edit=1 ID: 78441 Patch added by: cmb@php.net Reported by: cmb@php.net Summary: Parse error due to heredoc identifier followed by digit Status: Open Type: Bug Package: Scripting Engine problem Operating System: * PHP Version: 7.3Git-2019-08-21 (Git) Block user comment: N Private report: N New Comment: The following pull request has been associated: Patch Name: Fix #78441: Parse error due to heredoc identifier followed by digit On GitHub: https://github.com/php/php-src/pull/4591 Patch: https://github.com/php/php-src/pull/4591.patch Previous Comments: ------------------------------------------------------------------------ [2019-08-21 17:06:29] cmb@php.net Description: ------------ If a heredoc/nowdoc identifier is immediately followed by a digit, it is mistankenly recognized as closing identifier. While the documentation on the relaxed heredoc/nowdoc is sparse yet, the RFC[1] claims: | The implementation I am proposing avoids this problem by | checking to see if a continuation of the found marker exists, and | if so, then if it forms a valid identifier. This means that the | terminating marker string will only be considered as such if it is | matched exactly as a standalone, valid symbol (that is also found | at the start of the line). Since digits are allowed in identifiers, I think the current behavior is a bug. [1] <https://wiki.php.net/rfc/flexible_heredoc_nowdoc_syntaxes> Test script: --------------- <?php echo <<<FOO FOO4 FOO; Expected result: ---------------- FOO4 Actual result: -------------- Parse error: syntax error, unexpected '4' (T_LNUMBER), expecting ';' or ',' in %d on line 3 ------------------------------------------------------------------------ -- Edit this bug report at https://bugs.php.net/bug.php?id=78441&edit=1

« previous php.bugs (#222357) next »