Edit report at https://bugs.php.net/bug.php?id=60540&edit=1
ID: 60540 Updated by: fel...@php.net Reported by: constantine dot exelsior at gmail dot com Summary: nowdoc & heredoc definition fails on leaving scripts without php end-tag -Status: Open +Status: Bogus Type: Bug Package: Scripting Engine problem Operating System: all PHP Version: 5.3.8 Block user comment: N Private report: N New Comment: Thank you for taking the time to write to us, but this is not a bug. Please double-check the documentation available at http://www.php.net/manual/ and the instructions on how to report a bug at http://bugs.php.net/how-to-report.php As says the documentation: "The closing delimiter (possibly followed by a semicolon) must also be followed by a newline." Just put a newline after the heredoc/nowdoc closing delimiter. Previous Comments: ------------------------------------------------------------------------ [2011-12-15 22:14:57] constantine dot exelsior at gmail dot com Description: ------------ Scripts explicitly started with <?php, but leaved without an ending ?> having nowdoc or heredoc definitions inside will result in an syntax error. Full Error description: Parse error: syntax error, unexpected $end, expecting T_VARIABLE or T_END_HEREDOC or T_DOLLAR_OPEN_CURLY_BRACES or T_CURLY_OPEN in <FILE> on line <NUMBER> tested environment: Zend Server Community Edition PHP Version 5.3.8-ZS5.5.0 Workarround Solution: Simply close the <?php on scripts having nowdoc or heredoc definitions. In bigger projects the most developer leaved any scripts arround without an closing php-tag as usual to prevent printing out blank spaces / lines to the client. Test script: --------------- <?php echo <<<'EOT' <b>test</b> EOT; Expected result: ---------------- <b>test</b> Actual result: -------------- Parse error: syntax error, unexpected $end, expecting T_VARIABLE or T_END_HEREDOC or T_DOLLAR_OPEN_CURLY_BRACES or T_CURLY_OPEN in C:\Program Files (x86)\Zend\Apache2\htdocs\bam.php on line 4 ------------------------------------------------------------------------ -- Edit this bug report at https://bugs.php.net/bug.php?id=60540&edit=1