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
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If this is not your bug, you can add a comment by following this link.
If this is your bug, but you forgot your password, you can retrieve your password here.
Password:
Status:
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

Add a Patch

Pull Requests

Add a Pull Request

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: Thu Apr 25 22:01:29 2024 UTC