Bug #79934 [Ver->Csd]: CRLF-only line in heredoc causes parsing error
| From: | nikic@php.net | Date: | Thu, 06 Aug 2020 10:04:50 +0000 |
| Subject: | Bug #79934 [Ver->Csd]: CRLF-only line in heredoc causes parsing error | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-228424@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
Updated by: nikic@php.net
Reported by: pevandenham at gmail dot com
Summary: CRLF-only line in heredoc causes parsing error
-Status: Verified
+Status: Closed
Type: Bug
Package: Scripting Engine problem
Operating System: Any
PHP Version: 7.4.8
Block user comment: N
Private report: N
New Comment:
Automatic comment on behalf of p.e.vandenham@gmail.com
Revision: http://git.php.net/?p=php-src.git;a=commit;h=06ade15528fa64acd9dea92b072a985793d1dcc1
Log: Fix #79934: CRLF-only line in heredoc causes parsing error
Previous Comments:
------------------------------------------------------------------------
[2020-08-05 18:34:27] 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: https://github.com/php/php-src/pull/5944
Patch: https://github.com/php/php-src/pull/5944.patch
------------------------------------------------------------------------
[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