Bug #51550 [Opn]: 'Open php' tag at end of file causes 'syntax error, unexpected $end'
| From: | johannes@php.net | Date: | Tue, 13 Apr 2010 14:10:08 +0000 |
| Subject: | Bug #51550 [Opn]: 'Open php' tag at end of file causes 'syntax error, unexpected $end' | ||
| References: | 1 | Groups: | php.doc.bugs |
| Request: | Send a blank email to doc-bugs+get-4199@lists.php.net to get a copy of this message | ||
Edit report at http://bugs.php.net/bug.php?id=51550&edit=1
ID: 51550
Updated by: johannes@php.net
Reported by: daan at react dot com
Summary: 'Open php' tag at end of file causes 'syntax error,
unexpected $end'
Status: Open
Type: Bug
-Package: Scripting Engine problem
+Package: Documentation problem
Operating System: Debian Etch
PHP Version: 5.2.13
New Comment:
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.
Previous Comments:
------------------------------------------------------------------------
[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