|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #79934 CRLF-only line in heredoc causes parsing error
Submitted: 2020-08-05 18:20 UTC Modified: 2020-08-06 07:54 UTC
From: pevandenham at gmail dot com Assigned:
Status: Closed Package: Scripting Engine problem
PHP Version: 7.4.8 OS: Any
Private report: No CVE-ID: None
View Add Comment Developer Edit
Anyone can comment on a bug. Have a simpler test case? Does it work for you on a different platform? Let us know!
Just going to say 'Me too!'? Don't clutter the database with that please !
Your email address:
Solve the problem:
33 - 10 = ?
Subscribe to this entry?

 [2020-08-05 18:20 UTC] pevandenham at gmail dot com
A line that only contains CRLF (i.e. a whitespace-only or empty line on Windows) in the middle of a heredoc causes a parse error. This affects any PHP script that has CRLF line endings. 

To reproduce on e.g. Ubuntu, one can use the unix2dos program to convert the test script below to use CRLF and reproduce the bug: unix2dos bug.php && php bug.php

Test script:

$a = <<<HEREDOC



Expected result:
string(4) "a


Actual result:
Parse error: Invalid body indentation level (expecting an indentation level of at least 4) in /tmp/test.php on line 5


Add a Patch

Pull Requests

Pull requests:

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2020-08-05 18:34 UTC] pevandenham at gmail dot com
The following pull request has been associated:

Patch Name: Fix #79934: CRLF-only line in heredoc causes parsing error
On GitHub:
 [2020-08-06 07:54 UTC]
-Status: Open +Status: Verified
 [2020-08-06 10:04 UTC]
Automatic comment on behalf of
Log: Fix #79934: CRLF-only line in heredoc causes parsing error
 [2020-08-06 10:04 UTC]
-Status: Verified +Status: Closed
PHP Copyright © 2001-2021 The PHP Group
All rights reserved.
Last updated: Sat Sep 18 04:03:36 2021 UTC