php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Doc Bug #81300 Heredocs closing identifiers
Submitted: 2021-07-26 14:34 UTC Modified: 2021-07-26 14:58 UTC
From: forums at artfulrobot dot uk Assigned: cmb (profile)
Status: Duplicate Package: Scripting Engine problem
PHP Version: 7.3.29 OS: Linux
Private report: No CVE-ID: None
View Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
If you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: forums at artfulrobot dot uk
New email:
PHP Version: OS:

 

 [2021-07-26 14:34 UTC] forums at artfulrobot dot uk
Description:
------------
---
From manual page: https://php.net/language.types.string
---

It appears that since 7.3 a heredoc may never include the heredoc identifier if it is the first item on an indented line.

Before 7.3, the interpretation was as described in the docs: indentation means the identifier would be considered part of the enclosed text. Which made sense.

Test script:
---------------
// In 7.2, this works, in 7.3+ it fails, misinterpreting the indented "SOMETHING" 
// on the 2nd line as closing the heredoc.
$string = <<<SOMETHING
   SOMETHING weird is going on.
SOMETHING;

Actual result:
--------------
**unexpected 'is' (T_STRING)** 

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2021-07-26 14:58 UTC] cmb@php.net
-Status: Open +Status: Duplicate -Type: Bug +Type: Documentation Problem -Package: Reproducible crash +Package: Scripting Engine problem -Assigned To: +Assigned To: cmb
 [2021-07-26 14:58 UTC] cmb@php.net
See <https://wiki.php.net/rfc/flexible_heredoc_nowdoc_syntaxes>.
Closing as duplicate of bug #78425.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sat Dec 21 11:01:30 2024 UTC