From:             
Operating system: Debian Etch
PHP version:      5.2.13
Package:          Scripting Engine problem
Bug Type:         Bug
Bug description:'Open php' tag at end of file causes 'syntax error, unexpected 
$end'

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 bug report at http://bugs.php.net/bug.php?id=51550&edit=1
-- 
Try a snapshot (PHP 5.2):            
http://bugs.php.net/fix.php?id=51550&r=trysnapshot52
Try a snapshot (PHP 5.3):            
http://bugs.php.net/fix.php?id=51550&r=trysnapshot53
Try a snapshot (PHP 6.0):            
http://bugs.php.net/fix.php?id=51550&r=trysnapshot60
Fixed in SVN:                        
http://bugs.php.net/fix.php?id=51550&r=fixed
Fixed in SVN and need be documented: 
http://bugs.php.net/fix.php?id=51550&r=needdocs
Fixed in release:                    
http://bugs.php.net/fix.php?id=51550&r=alreadyfixed
Need backtrace:                      
http://bugs.php.net/fix.php?id=51550&r=needtrace
Need Reproduce Script:               
http://bugs.php.net/fix.php?id=51550&r=needscript
Try newer version:                   
http://bugs.php.net/fix.php?id=51550&r=oldversion
Not developer issue:                 
http://bugs.php.net/fix.php?id=51550&r=support
Expected behavior:                   
http://bugs.php.net/fix.php?id=51550&r=notwrong
Not enough info:                     
http://bugs.php.net/fix.php?id=51550&r=notenoughinfo
Submitted twice:                     
http://bugs.php.net/fix.php?id=51550&r=submittedtwice
register_globals:                    
http://bugs.php.net/fix.php?id=51550&r=globals
PHP 4 support discontinued:          http://bugs.php.net/fix.php?id=51550&r=php4
Daylight Savings:                    http://bugs.php.net/fix.php?id=51550&r=dst
IIS Stability:                       
http://bugs.php.net/fix.php?id=51550&r=isapi
Install GNU Sed:                     
http://bugs.php.net/fix.php?id=51550&r=gnused
Floating point limitations:          
http://bugs.php.net/fix.php?id=51550&r=float
No Zend Extensions:                  
http://bugs.php.net/fix.php?id=51550&r=nozend
MySQL Configuration Error:           
http://bugs.php.net/fix.php?id=51550&r=mysqlcfg

Reply via email to