ID: 50786 Updated by: [email protected] 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
