php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #40906 meta tag automagically appears in XHTML documents
Submitted: 2007-03-23 22:58 UTC Modified: 2007-03-24 18:33 UTC
From: php at phihag dot de Assigned:
Status: Not a bug Package: DOM XML related
PHP Version: 5.2.1 OS: independent
Private report: No CVE-ID: None
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: php at phihag dot de
New email:
PHP Version: OS:

 

 [2007-03-23 22:58 UTC] php at phihag dot de
Description:
------------
When creating a <head> tag inside a XHTML document which is designated as that by a specified doctype, a strange tag is inserted automatically.

I suppose this is because http://www.w3.org/TR/xslt#section-HTML-Output-Method specifies this for HTML output. However, this tag is even wrong in this XHTML case because it states "Content-Type: text/html" instead of the right "Content-Type: application/xhtml+xml".


Reproduce code:
---------------
<?php
$doc = new DOMDOcument();
$doc->loadXML('<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">' .
        '<html xmlns="http://www.w3.org/1999/xhtml" />');
$head = $doc->documentElement->appendChild($doc->createElement("head"));

echo $doc->saveXML();

?>


Expected result:
----------------
<?xml version="1.0"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head />
</html>

Actual result:
--------------
<?xml version="1.0"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
</head></html>



Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2007-03-24 18:33 UTC] rrichards@php.net
Sorry, but your problem does not imply a bug in PHP itself.  For a
list of more appropriate places to ask for help using PHP, please
visit http://www.php.net/support.php as this bug system is not the
appropriate forum for asking support questions.  Due to the volume
of reports we can not explain in detail here why your report is not
a bug.  The support channels will be able to provide an explanation
for you.

Thank you for your interest in PHP.

behvaior is from libxml2 and it is correct (read the xhtml specs)
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sun May 19 18:01:33 2024 UTC