Bug #76439 [Opn]: Changed behaviour in unclosed HereDoc
| From: | danack@php.net | Date: | Sat, 09 Jun 2018 22:45:57 +0000 |
| Subject: | Bug #76439 [Opn]: Changed behaviour in unclosed HereDoc | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-215571@lists.php.net to get a copy of this message | ||
Edit report at https://bugs.php.net/bug.php?id=76439&edit=1
ID: 76439
Updated by: danack@php.net
Reported by: love at sickpeople dot se
-Summary: Variables in heredoc does not work properly
+Summary: Changed behaviour in unclosed HereDoc
Status: Open
Type: Bug
Package: Scripting Engine problem
PHP Version: 7.3.0alpha1
Block user comment: N
Private report: N
New Comment:
Running you exact code gives me the error "Parse error: syntax error, unexpected end of file in
/in/VQqm7 on line 12" - https://3v4l.org/VQqm7
That's because there are spaces before the "BAR;" in your script, and the parser gets
to the end of the file unexpectedly.
Removing those spaces makes the script work - https://3v4l.org/19bhe
However I'm going to leave this open as the error has changed for PHP7.3alpha, and it makes no
sense.
Previous Comments:
------------------------------------------------------------------------
[2018-06-09 22:24:09] love at sickpeople dot se
Description:
------------
"$foo" in heredoc works, while "$foo." triggers a ParseError.
For clarity with newlines etc, the script below encoded:
PD9waHAKCiRmb28gPSAnZm9vJzsKCmVjaG8gPDw8QkFSCiAkZm9vCiBCQVI7CgplY2hvIDw8PEJBUgogJGZvby4KIEJBUjsKCg==
Test script:
---------------
$foo = 'foo';
echo <<<BAR
$foo
BAR;
echo <<<BAR
$foo.
BAR;
Expected result:
----------------
No ParseError.
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=76439&edit=1