Bug #79934 [PATCH]: CRLF-only line in heredoc causes parsing error
| From: | pevandenham@gmail.com | Date: | Wed, 05 Aug 2020 18:34:27 +0000 |
| Subject: | Bug #79934 [PATCH]: CRLF-only line in heredoc causes parsing error | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-228420@lists.php.net to get a copy of this message | ||
Edit report at https://bugs.php.net/bug.php?id=79934&edit=1
ID: 79934
Patch added by: pevandenham@gmail.com
Reported by: pevandenham at gmail dot com
Summary: CRLF-only line in heredoc causes parsing error
Status: Open
Type: Bug
Package: Scripting Engine problem
Operating System: Any
PHP Version: 7.4.8
Block user comment: N
Private report: N
New Comment:
The following pull request has been associated:
Patch Name: Fix #79934: CRLF-only line in heredoc causes parsing error
On GitHub: https://github.com/php/php-src/pull/5944
Patch: https://github.com/php/php-src/pull/5944.patch
Previous Comments:
------------------------------------------------------------------------
[2020-08-05 18:20:01] pevandenham at gmail dot com
Description:
------------
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:
---------------
<?php
$a = <<<HEREDOC
a
b
HEREDOC;
var_dump($a);
Expected result:
----------------
string(4) "a
b"
Actual result:
--------------
Parse error: Invalid body indentation level (expecting an indentation level of at least 4) in
/tmp/test.php on line 5
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=79934&edit=1