Doc #72468 [Ver->Csd]: heredoc seem actually supported in static declarations
| From: | cmb@php.net | Date: | Wed, 22 Jun 2016 11:04:19 +0000 |
| Subject: | Doc #72468 [Ver->Csd]: heredoc seem actually supported in static declarations | ||
| References: | 1 | Groups: | php.doc.bugs |
| Request: | Send a blank email to doc-bugs+get-13583@lists.php.net to get a copy of this message | ||
Edit report at https://bugs.php.net/bug.php?id=72468&edit=1
ID: 72468
Updated by: cmb@php.net
Reported by: info at developiu dot it
Summary: heredoc seem actually supported in static
declarations
-Status: Verified
+Status: Closed
Type: Documentation Problem
Package: Documentation problem
Operating System: centos linux
PHP Version: 7.0.7
Assigned To: cmb
Block user comment: N
Private report: N
New Comment:
This bug has been fixed in the documentation's XML sources. Since the
online and downloadable versions of the documentation need some time
to get updated, we would like to ask you to be a bit patient.
Thank you for the report, and for helping us make our documentation better.
Previous Comments:
------------------------------------------------------------------------
[2016-06-22 11:03:52] cmb@php.net
Automatic comment from SVN on behalf of cmb
Revision: http://svn.php.net/viewvc/?view=revision&revision=339448
Log: Fix #72468: heredoc seem actually supported in static declarations
------------------------------------------------------------------------
[2016-06-22 10:39:34] cmb@php.net
Further reference: <https://3v4l.org/j6uW9>.
------------------------------------------------------------------------
[2016-06-22 10:36:32] cmb@php.net
Indeed, Nowdoc as well as Heredoc syntax is supported as of PHP
5.3.0, see <https://3v4l.org/bWajs>. Thanks!
> BTW: is there a way for me to propose a patch to some file in
> order to minimize your work on fixing these sort of bugs?
Normally, you could submit patches via the online editor
(<https://edit.php.net/>). Unfortunately, the certificate
has been
expired and not yet been renewed, so the editor is not usable
currently[1].
For now you might submit patches to this bug tracker; see also
<http://doc.php.net/tutorial/>.
[1] <https://bugs.php.net/72349>
------------------------------------------------------------------------
[2016-06-22 09:17:20] info at developiu dot it
I noticed only now that also the previous declaration is accepted by my version of php, namely the
following one:
public $var1 = 'hello ' . 'world';
------------------------------------------------------------------------
[2016-06-22 09:14:26] info at developiu dot it
Description:
------------
This bug is similar to bug #70227, but it is related to a different page.
the page at url http://php.net/manual/en/language.oop5.properties.php
states the following (see Example #1 property declarations):
"Unlike heredocs, nowdocs can be used in any static data context, including property
declarations."
This seem to imply that that heredocs are not allowed in static context but allowed in non static
context, but the write proably meant that they always disallowed, as explicitated by the previous
example, where the definition of $var2 is marked as invalid even if it is not static.
Actually heredocs can be used to define properties, as the script below shows (with the same syntax
marked as invalid in the example given in the documentation abow the "incriminated"
phrase). If you run it you'll see no error.
BTW: is there a way for me to propose a patch to some file in order to minimize your work on fixing
these sort of bugs?
Test script:
---------------
<?php
error_reporting(E_ALL);
class SimpleClass
{
public $var2 = <<<EOD
hello world
EOD;
}
$a=new SimpleClass();
echo $a->var2;
?>
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=72468&edit=1