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

From: Date: Wed, 21 Aug 2019 17:06:29 +0000
Subject: Bug #78441 [NEW]: Parse error due to heredoc identifier followed by digit
Groups: php.bugs 
Request: Send a blank email to php-bugs+get-222353@lists.php.net to get a copy of this message
From: cmb Operating system: * PHP version: 7.3Git-2019-08-21 (Git) Package: Scripting Engine problem Bug Type: Bug Bug description:Parse error due to heredoc identifier followed by digit 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 bug report at https://bugs.php.net/bug.php?id=78441&edit=1 -- Fix committed: https://bugs.php.net/fix.php?id=78441&r=fixed Fixed in release: https://bugs.php.net/fix.php?id=78441&r=alreadyfixed Need backtrace: https://bugs.php.net/fix.php?id=78441&r=needtrace Need Reproduce Script: https://bugs.php.net/fix.php?id=78441&r=needscript Try newer version: https://bugs.php.net/fix.php?id=78441&r=oldversion Not developer issue: https://bugs.php.net/fix.php?id=78441&r=support Expected behavior: https://bugs.php.net/fix.php?id=78441&r=notwrong Not enough info: https://bugs.php.net/fix.php?id=78441&r=notenoughinfo Submitted twice: https://bugs.php.net/fix.php?id=78441&r=submittedtwice register_globals: https://bugs.php.net/fix.php?id=78441&r=globals PHP version support discontinued: https://bugs.php.net/fix.php?id=78441&r=phptooold Daylight Savings: https://bugs.php.net/fix.php?id=78441&r=dst IIS Stability: https://bugs.php.net/fix.php?id=78441&r=isapi Install GNU Sed: https://bugs.php.net/fix.php?id=78441&r=gnused Floating point limitations: https://bugs.php.net/fix.php?id=78441&r=float No Zend Extensions: https://bugs.php.net/fix.php?id=78441&r=nozend MySQL Configuration Error: https://bugs.php.net/fix.php?id=78441&r=mysqlcfg

« previous php.bugs (#222353) next »