Bug #78441 [Opn->Csd]: Parse error due to heredoc identifier followed by digit
| From: | cmb@php.net | Date: | Wed, 21 Aug 2019 20:56:03 +0000 |
| Subject: | Bug #78441 [Opn->Csd]: Parse error due to heredoc identifier followed by digit | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-222359@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
Updated by: cmb@php.net
Reported by: cmb@php.net
Summary: Parse error due to heredoc identifier followed by
digit
-Status: Open
+Status: Closed
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:
Automatic comment on behalf of cmbecker69@gmx.de
Revision: http://git.php.net/?p=php-src.git;a=commit;h=310708845ff02b9e252b7a02616290384dd846ba
Log: Fix #78441: Parse error due to heredoc identifier followed by digit
Previous Comments:
------------------------------------------------------------------------
[2019-08-21 17:24:47] cmb@php.net
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
------------------------------------------------------------------------
[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