Doc #72468 [Opn]: heredoc seem actually supported in static declarations
| From: | info at developiu dot it | Date: | Wed, 22 Jun 2016 09:17:21 +0000 |
| Subject: | Doc #72468 [Opn]: heredoc seem actually supported in static declarations | ||
| References: | 1 | Groups: | php.doc.bugs |
| Request: | Send a blank email to doc-bugs+get-13580@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
User updated by: info at developiu dot it
Reported by: info at developiu dot it
Summary: heredoc seem actually supported in static
declarations
Status: Open
Type: Documentation Problem
Package: Documentation problem
Operating System: centos linux
PHP Version: 7.0.7
Block user comment: N
Private report: N
New Comment:
I noticed only now that also the previous declaration is accepted by my version of php, namely the
following one:
public $var1 = 'hello ' . 'world';
Previous Comments:
------------------------------------------------------------------------
[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