#50786 [Opn->Bgs]: HEREDOC at EOF Error
| From: | jani@php.net | Date: | Mon, 18 Jan 2010 10:11:41 +0000 |
| Subject: | #50786 [Opn->Bgs]: HEREDOC at EOF Error | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-146760@lists.php.net to get a copy of this message | ||
ID: 50786
Updated by: jani@php.net
Reported By: ldrut at charter dot net
-Status: Open
+Status: Bogus
Bug Type: Scripting Engine problem
Operating System: LINUX
PHP Version: 5.2.12
New Comment:
In our manual it says quite clearly:
"The closing delimiter (possibly followed by a semicolon) must also be
followed by a newline." http://php.net/heredoc
Previous Comments:
------------------------------------------------------------------------
[2010-01-17 18:25:25] ldrut at charter dot net
Description:
------------
Bug observed in 5.2.9. Shared hosting - can't upgrade. Review of
changelog does not suggest a fix has been made.
Documentation stated HEREDOC closing line must be only text on line,
but it also appears that the closing text MUST be followed by a new
line. If the HEREDOC closes the file with no terminating /n, an error is
produced. Addition of a 1-line comment in a following line clears the
error (as does anything else that forces a newline - my editor strips
trailing /n from the document).
I'm not sure if this is a documentation error or a scripting error as I
don't know which way is intended behavior.
Reproduce code:
---------------
<?php
$v = <<<EOF
Anything, but there is nothing in the file following
the upcoming semicolon
EOF;
Expected result:
----------------
no output. Assigns variable.
Actual result:
--------------
"Parse error: syntax error, unexpected $end"
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=50786&edit=1