Edit report at http://bugs.php.net/bug.php?id=51550&edit=1
ID: 51550 Updated by: degeb...@php.net Reported by: daan at react dot com Summary: 'Open php' tag at end of file causes 'syntax error, unexpected $end' -Status: Open +Status: Closed Type: Bug -Package: Documentation problem +Package: Scripting Engine problem Operating System: Debian Etch PHP Version: 5.2.13 -Assigned To: +Assigned To: degeberg 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. Previous Comments: ------------------------------------------------------------------------ [2010-04-13 16:23:31] degeb...@php.net Automatic comment from SVN on behalf of degeberg Revision: http://svn.php.net/viewvc/?view=revision&revision=297962 Log: Fixed PHP bug #51550 ('Open php' tag at end of file causes 'syntax error, unexpected ') ------------------------------------------------------------------------ [2010-04-13 16:10:08] johan...@php.net This is fixed in 5.3 with a new parser. This won't be fixed in 5.2. Maybe the doc team wants to add it to the documentation. ------------------------------------------------------------------------ [2010-04-13 15:40:13] daan at react dot com Description: ------------ This probably is a known effect, but I will just open a bug so it can be documented as such: When you end a file with a PHP open tag '<?php', and there is no character beyond the tag the parser chokes with an 'unexpected $end' parse error. Curiously, a short tag '<?' (if enabled) used in such a way raises no error. This effect is of course also seen when you eval a string containing an PHP open tag at the end of the string. (from there I originally stumbled on this behaviour) In PHP 5.3 the code behaves as expected, so someone probably already spotted this one, or fixed the parser to be less nitty. Test script: --------------- <?php Expected result: ---------------- Nothin Actual result: -------------- Parse error: syntax error, unexpected $end in test.php on line 1 ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/bug.php?id=51550&edit=1