|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2009-12-25 00:19 UTC] johannes@php.net
[2009-12-25 00:33 UTC] rasmus@php.net
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Tue Oct 28 21:00:01 2025 UTC |
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