Req #50324 [Opn->Wfx]: Invalid phpinfo XHTML code.
| From: | jani@php.net | Date: | Wed, 01 Dec 2010 15:30:14 +0000 |
| Subject: | Req #50324 [Opn->Wfx]: Invalid phpinfo XHTML code. | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-156651@lists.php.net to get a copy of this message | ||
Edit report at http://bugs.php.net/bug.php?id=50324&edit=1
ID: 50324
Updated by: jani@php.net
Reported by: winner5 at interia dot pl
Summary: Invalid phpinfo XHTML code.
-Status: Open
+Status: Wont fix
Type: Feature/Change Request
-Package: Feature/Change Request
+Package: *General Issues
Operating System: Linux
PHP Version: 5.3.1
Block user comment: N
Private report: N
New Comment:
It's a debug tool. Not gonna change.
Previous Comments:
------------------------------------------------------------------------
[2009-11-29 13:50:23] winner5 at interia dot pl
Description:
------------
phpinfo function generates invalid code. It tries to look like XHTML,
but it has:
'<html>' instead of '<html xmlns="http://www.w3.org/1999/xhtml">',
'<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"
/>'
instead of '<meta http-equiv="Content-Type"
content="application/xhtml+xml; charset="utf-8""/>', the DTD
declaration id invalid, it should be:
'<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">'
if you stick
at using XHTML 1.0 Transitional, it would be better if you use:
'<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">'.
In addition there is
no XML declaration. It should be:
'<?xml version="1.0" encoding="utf-8"
standalone="no"?>' at the very
beginning of the document and '<br />' should be replaced with:
'<br/>'.
I know that the code is valid due to W3C Validator, but when I use the
function phpinfo(); I get plain text. When I add header('Content-Type:
application/xhtml+xml; charset="utf-8"');, I receive XML without xmlns,
so it still looks like plain text.
Reproduce code:
---------------
<?php
phpinfo();
?>
Expected result:
----------------
The same as I receive by using:
<?php
header('Content-Type: application/xhtml+xml;lcharset="utf-8"');
ob_start();
phpinfo();
$dom = new DOMDocument('1.0', 'utf-8');
@$dom->loadXML(ob_get_clean());
$dom->documentElement->xmlNamespace = 'http://www.w3.org/1999/xhtml';
print($dom->saveXML());
?>
and of course with corrections for:
'<meta/>', '<br/>'.
Actual result:
--------------
plain text. Just the source.
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/bug.php?id=50324&edit=1