From: rarpsl at banet dot net Operating system: PHP PHP version: 5.2.12 PHP Bug Type: Feature/Change Request Bug description: <?xml Header not Special Cased
Description: ------------ For over 6 years (or more) PHP has refused to accept a valid XHTML pages that begin with the a <?xml version="1.0" encoding="utf-8"?> tag. While this bug can be worked around by using an echo command to output the tag, this makes the code non-compliant with verifiers that do not see the echo'ed tag but only the PHP code itself. Since the first line in an XHTML page can be the <?xml tag (which is not valid anywhere else) the PHP interpreter should be able to parse the tag and then accept/ignore it so long as it is the first thing encountered. If it is not the first line, then the current trap code can handle it as it currently does when it is validly placed. Reproduce code: --------------- <?xml version=\"1.0\" encoding=\"utf-8\"?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> <head> . . . (etc) Expected result: ---------------- A display of my PHP Page (as would occur without the <?xml tag). Actual result: -------------- Parse error: syntax error, unexpected T_STRING in /home/gjzvtbxe/public_html/test3.php on line 1 -- Edit bug report at http://bugs.php.net/?id=50572&edit=1 -- Try a snapshot (PHP 5.2): http://bugs.php.net/fix.php?id=50572&r=trysnapshot52 Try a snapshot (PHP 5.3): http://bugs.php.net/fix.php?id=50572&r=trysnapshot53 Try a snapshot (PHP 6.0): http://bugs.php.net/fix.php?id=50572&r=trysnapshot60 Fixed in SVN: http://bugs.php.net/fix.php?id=50572&r=fixed Fixed in SVN and need be documented: http://bugs.php.net/fix.php?id=50572&r=needdocs Fixed in release: http://bugs.php.net/fix.php?id=50572&r=alreadyfixed Need backtrace: http://bugs.php.net/fix.php?id=50572&r=needtrace Need Reproduce Script: http://bugs.php.net/fix.php?id=50572&r=needscript Try newer version: http://bugs.php.net/fix.php?id=50572&r=oldversion Not developer issue: http://bugs.php.net/fix.php?id=50572&r=support Expected behavior: http://bugs.php.net/fix.php?id=50572&r=notwrong Not enough info: http://bugs.php.net/fix.php?id=50572&r=notenoughinfo Submitted twice: http://bugs.php.net/fix.php?id=50572&r=submittedtwice register_globals: http://bugs.php.net/fix.php?id=50572&r=globals PHP 4 support discontinued: http://bugs.php.net/fix.php?id=50572&r=php4 Daylight Savings: http://bugs.php.net/fix.php?id=50572&r=dst IIS Stability: http://bugs.php.net/fix.php?id=50572&r=isapi Install GNU Sed: http://bugs.php.net/fix.php?id=50572&r=gnused Floating point limitations: http://bugs.php.net/fix.php?id=50572&r=float No Zend Extensions: http://bugs.php.net/fix.php?id=50572&r=nozend MySQL Configuration Error: http://bugs.php.net/fix.php?id=50572&r=mysqlcfg