php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #16963 problem with <?xml
Submitted: 2002-05-02 09:15 UTC Modified: 2002-05-02 10:12 UTC
From: bate@php.net Assigned:
Status: Not a bug Package: *General Issues
PHP Version: 4.2.0 OS: Linux
Private report: No CVE-ID: None
 [2002-05-02 09:15 UTC] bate@php.net
<?xml version="1.0" encoding="iso-8859-1"?>
<!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">
<head>
<title>TEST</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
</head>

<body leftmargin="0" topmargin="0" marginwidth="00">
<? echo "This is a Test"; ?>
</body>
</html>


Parse error: parse error, unexpected T_STRING in /usr/local/httpd/htdocs/coding/bug/xml.php on line 1

Its seems to be a bug with the <?xml stuff.

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2002-05-02 09:16 UTC] derick@php.net
Disable short tags.
Nog a bug > bogus.
 [2002-05-02 09:20 UTC] bate@php.net
Derick, most public ISP didn't disable shortags. And i think its better to check the chars behind the <? tag.

if none its look like php short tag.
 [2002-05-02 09:24 UTC] edink@php.net
You can change the first line to:

<? echo '<?xml'; ?> version="1.0" encoding="iso-8859-1"?>

 [2002-05-02 10:07 UTC] bate@php.net
I know some workarounds to fix this little problem, but is this not a general problem? <?xml are signed by RFC and its not ok that the parse didnt check this.
 [2002-05-02 10:10 UTC] yohgaki@php.net
Checking the chars behind the <? tag is not a feasible solution. <? is XML processing tag, and we simply don't know what kind of processers are on the earth.

Portable formats are
<?php echo '<?xml version="1.0"?>' ?>
<?php echo '<?xml' ?> version="1.0"?>

It doesn't look nice, but it's historical reason...


 [2002-05-02 10:12 UTC] jtate@php.net
I agree that php's handling of this case is poor.  However the user should take it up with the ISP.  If they want to keep your business, they should try to make you happy.  If they don't, then find a different ISP.
 
PHP Copyright © 2001-2025 The PHP Group
All rights reserved.
Last updated: Mon Aug 18 13:00:02 2025 UTC