|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #78441 Parse error due to heredoc identifier followed by digit
Submitted: 2019-08-21 17:06 UTC Modified: 2019-08-21 20:57 UTC
From: Assigned: cmb (profile)
Status: Closed Package: Scripting Engine problem
PHP Version: 7.3Git-2019-08-21 (Git) OS: *
Private report: No CVE-ID: None
 [2019-08-21 17:06 UTC]
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] <>

Test script:
echo <<<FOO

Expected result:

Actual result:
Parse error: syntax error, unexpected '4' (T_LNUMBER), expecting ';' or ',' in %d on line 3


Add a Patch

Pull Requests

Pull requests:

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2019-08-21 17:24 UTC]
The following pull request has been associated:

Patch Name: Fix #78441: Parse error due to heredoc identifier followed by digit
On GitHub:
 [2019-08-21 20:56 UTC]
Automatic comment on behalf of
Log: Fix #78441: Parse error due to heredoc identifier followed by digit
 [2019-08-21 20:56 UTC]
-Status: Open +Status: Closed
 [2019-08-21 20:57 UTC]
-Assigned To: +Assigned To: cmb
PHP Copyright © 2001-2023 The PHP Group
All rights reserved.
Last updated: Thu Sep 28 19:01:25 2023 UTC