#50324 [NEW]: Invalid phpinfo XHTML code.
| From: | winner5 at interia dot pl | Date: | Sun, 29 Nov 2009 13:50:23 +0000 |
| Subject: | #50324 [NEW]: Invalid phpinfo XHTML code. | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-145184@lists.php.net to get a copy of this message | ||
From: winner5 at interia dot pl
Operating system: Linux
PHP version: 5.3.1
PHP Bug Type: PHP options/info functions
Bug description: Invalid phpinfo XHTML code.
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 bug report at http://bugs.php.net/?id=50324&edit=1
--
Try a snapshot (PHP 5.2): http://bugs.php.net/fix.php?id=50324&r=trysnapshot52
Try a snapshot (PHP 5.3): http://bugs.php.net/fix.php?id=50324&r=trysnapshot53
Try a snapshot (PHP 6.0): http://bugs.php.net/fix.php?id=50324&r=trysnapshot60
Fixed in SVN: http://bugs.php.net/fix.php?id=50324&r=fixed
Fixed in SVN and need be documented: http://bugs.php.net/fix.php?id=50324&r=needdocs
Fixed in release: http://bugs.php.net/fix.php?id=50324&r=alreadyfixed
Need backtrace: http://bugs.php.net/fix.php?id=50324&r=needtrace
Need Reproduce Script: http://bugs.php.net/fix.php?id=50324&r=needscript
Try newer version: http://bugs.php.net/fix.php?id=50324&r=oldversion
Not developer issue: http://bugs.php.net/fix.php?id=50324&r=support
Expected behavior: http://bugs.php.net/fix.php?id=50324&r=notwrong
Not enough info: http://bugs.php.net/fix.php?id=50324&r=notenoughinfo
Submitted twice: http://bugs.php.net/fix.php?id=50324&r=submittedtwice
register_globals: http://bugs.php.net/fix.php?id=50324&r=globals
PHP 4 support discontinued: http://bugs.php.net/fix.php?id=50324&r=php4
Daylight Savings: http://bugs.php.net/fix.php?id=50324&r=dst
IIS Stability: http://bugs.php.net/fix.php?id=50324&r=isapi
Install GNU Sed: http://bugs.php.net/fix.php?id=50324&r=gnused
Floating point limitations: http://bugs.php.net/fix.php?id=50324&r=float
No Zend Extensions: http://bugs.php.net/fix.php?id=50324&r=nozend
MySQL Configuration Error: http://bugs.php.net/fix.php?id=50324&r=mysqlcfg