Doc #77812 [Com]: 7.3 heredoc syntax not documented in manual proper
| From: | chasepeeler at gmail dot com | Date: | Wed, 03 Apr 2019 17:54:07 +0000 |
| Subject: | Doc #77812 [Com]: 7.3 heredoc syntax not documented in manual proper | ||
| References: | 1 | Groups: | php.doc.bugs |
| Request: | Send a blank email to doc-bugs+get-16543@lists.php.net to get a copy of this message | ||
Edit report at https://bugs.php.net/bug.php?id=77812&edit=1
ID: 77812
Comment by: chasepeeler at gmail dot com
Reported by: bugs dot php dot net at ss dot st dot tc
Summary: 7.3 heredoc syntax not documented in manual proper
Status: Re-Opened
Type: Documentation Problem
Package: Strings related
Operating System: *
PHP Version: 7.3
Block user comment: N
Private report: N
New Comment:
The documentation at https://www.php.net/manual/en/migration73.incompatible.php#migration73.incompatible.core.heredoc-nowdoc
is definitely wrong.
As written:
<?php
$str = <<<FOO
abcdefg
FOO
FOO;
?>
will not produce the error mentioned. Instead, it will give the following:
Parse error: Invalid body indentation level (expecting an indentation level of at least 4)
If you don't indent that line:
<?php
$str = <<<FOO
abcdefg
FOO
FOO;
?>
You'll get an error, but still not the one reported. This appears to be a bug though, as
it's requiring a semicolon after the identifier, despite the fact that documentation says that
is no longer required. See https://bugs.php.net/bug.php?id=76608
Previous Comments:
------------------------------------------------------------------------
[2019-03-28 09:54:54] cmb@php.net
> [â¦] which doesn't even mention new syntax.
Re-opening as doc bug, then.
------------------------------------------------------------------------
[2019-03-28 00:11:20] bugs dot php dot net at ss dot st dot tc
Oh thank you so much. I didn't look there.
Instead, was staring at https://www.php.net/manual/en/language.types.string.php#language.types.string.syntax.heredoc
which doesn't even mention new syntax.
Thanks again.
------------------------------------------------------------------------
[2019-03-28 00:03:28] a at b dot c dot de
This is the first entry listed under the "Backward Incompatible Changes" section of the
7.3 migration guide.
http://www.php.net/manual/en/migration73.incompatible.php
------------------------------------------------------------------------
[2019-03-27 20:13:27] bugs dot php dot net at ss dot st dot tc
Description:
------------
Old, pre-7.3 heredoc syntax works as expected in PHP 7.3 interactive shell:
$ php7.3 -a
Interactive shell
php > echo <<<FOO
<<< > bar
<<< > FOO;
bar
Now let's try 7.3 heredoc syntax:
$ php7.3 -a
Interactive shell
php > echo <<<FOO
<<< > bar
<<< > FOO;
<<< >
$ php7.3 -a
Interactive shell
php > print(<<<FOO
<<< > xx
<<< > FOO);
<<< >
$ php7.3 -a
Interactive shell
php > echo <<<FOO
<<< > xxx
<<< > FOO;
<<< > FOO
php > ;
xxxPHP Warning: Use of undefined constant FOO - assumed 'FOO' (this will throw an Error
in a future version of PHP) in php shell code on line 4
The latter example works well in PHP 7.2:
$ php7.2 -a
Interactive shell
php > echo <<<FOO
<<< > xxx
<<< > FOO;
<<< > FOO
php > ;
xxx
FOO;
php >
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=77812&edit=1