ID: 32554
Updated by: [EMAIL PROTECTED]
Reported By: 000005 at gmail dot com
-Status: Open
+Status: Closed
Bug Type: Documentation problem
Operating System: Linux 2.6/Gentoo
PHP Version: 4CVS,5CVS (2005-04-03)
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.
"It is not allowed to use heredoc syntax in initializing class members.
Use other string syntaxes instead." + example
P.S. You can initialize the member with multiline string with "first
line \n second" or "first line
second".
Previous Comments:
------------------------------------------------------------------------
[2005-04-04 01:23:46] 000005 at gmail dot com
> This is not really PHP bug but just
> missing documentation. (or I just couldn't
> find the place where it's documented :)
I couldn't find where this is documented either.
> You can only put static scalars as the
> default value.
I am able to initialize member variables with strings using single or
double quotes. Is a string a scalar?
Mainly, is there a way to initialize a member variable with a
multi-line string? I think there should be.
Thanks
------------------------------------------------------------------------
[2005-04-03 13:06:36] [EMAIL PROTECTED]
This is not really PHP bug but just missing documentation.
(or I just couldn't find the place where it's documented :)
You can only put static scalars as the default value.
------------------------------------------------------------------------
[2005-04-03 07:12:40] 000005 at gmail dot com
Description:
------------
Trying to initialize a member variable using heredoc
notation produces a compiler error:
Parse error: parse error, unexpected T_START_HEREDOC in
/.../foo.php on line 6
Reproduce code:
---------------
<?
class foo
{
public $bar = <<<END
blah blah blah
END;
}
?>
Expected result:
----------------
The member variable $bar to be assigned "blah blah
blah".
Actual result:
--------------
Parse error: parse error, unexpected T_START_HEREDOC in
/.../foo.php on line 6
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=32554&edit=1