php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Request #50324 Invalid phpinfo XHTML code.
Submitted: 2009-11-29 13:50 UTC Modified: 2010-12-01 16:30 UTC
From: winner5 at interia dot pl Assigned:
Status: Wont fix Package: *General Issues
PHP Version: 5.3.1 OS: Linux
Private report: No CVE-ID: None
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: winner5 at interia dot pl
New email:
PHP Version: OS:

 

 [2009-11-29 13:50 UTC] 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=&quot;utf-8&quot;"/>', 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.

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2010-12-01 16:30 UTC] jani@php.net
-Status: Open +Status: Wont fix -Package: Feature/Change Request +Package: *General Issues
 [2010-12-01 16:30 UTC] jani@php.net
It's a debug tool. Not gonna change.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sun Dec 22 17:01:29 2024 UTC