Bug #79934 [NEW]: CRLF-only line in heredoc causes parsing error
| From: | pevandenham at gmail dot com | Date: | Wed, 05 Aug 2020 18:20:02 +0000 |
| Subject: | Bug #79934 [NEW]: CRLF-only line in heredoc causes parsing error | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-228419@lists.php.net to get a copy of this message | ||
From: pevandenham at gmail dot com
Operating system: Any
PHP version: 7.4.8
Package: Scripting Engine problem
Bug Type: Bug
Bug description:CRLF-only line in heredoc causes parsing error
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 bug report at https://bugs.php.net/bug.php?id=79934&edit=1
--
Fix committed: https://bugs.php.net/fix.php?id=79934&r=fixed
Fixed in release: https://bugs.php.net/fix.php?id=79934&r=alreadyfixed
Need backtrace: https://bugs.php.net/fix.php?id=79934&r=needtrace
Need Reproduce Script: https://bugs.php.net/fix.php?id=79934&r=needscript
Try newer version: https://bugs.php.net/fix.php?id=79934&r=oldversion
Not developer issue: https://bugs.php.net/fix.php?id=79934&r=support
Expected behavior: https://bugs.php.net/fix.php?id=79934&r=notwrong
Not enough info: https://bugs.php.net/fix.php?id=79934&r=notenoughinfo
Submitted twice: https://bugs.php.net/fix.php?id=79934&r=submittedtwice
register_globals: https://bugs.php.net/fix.php?id=79934&r=globals
PHP version support discontinued: https://bugs.php.net/fix.php?id=79934&r=phptooold
Daylight Savings: https://bugs.php.net/fix.php?id=79934&r=dst
IIS Stability: https://bugs.php.net/fix.php?id=79934&r=isapi
Install GNU Sed: https://bugs.php.net/fix.php?id=79934&r=gnused
Floating point limitations: https://bugs.php.net/fix.php?id=79934&r=float
No Zend Extensions: https://bugs.php.net/fix.php?id=79934&r=nozend
MySQL Configuration Error: https://bugs.php.net/fix.php?id=79934&r=mysqlcfg