ID:               50572
 Updated by:       ras...@php.net
 Reported By:      rarpsl at banet dot net
 Status:           Bogus
 Bug Type:         Feature/Change Request
 Operating System: PHP
 PHP Version:      5.2.12
 New Comment:

Or the obvious solution, don't use short_tags.


Previous Comments:
------------------------------------------------------------------------

[2009-12-25 00:19:37] johan...@php.net

Thank you for taking the time to write to us, but this is not
a bug. Please double-check the documentation available at
http://www.php.net/manual/ and the instructions on how to report
a bug at http://bugs.php.net/how-to-report.php

What about <?xsl ? what about PHP scripts starting with <?xml_foo();?>
?

Adding this exception is not possible in a sane way.

------------------------------------------------------------------------

[2009-12-25 00:14:08] rarpsl at banet dot net

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 this bug report at http://bugs.php.net/?id=50572&edit=1

Reply via email to