#40906 [NEW]: meta tag automagically appears in XHTML documents
| From: | php at phihag dot de | Date: | Fri, 23 Mar 2007 22:58:36 +0000 |
| Subject: | #40906 [NEW]: meta tag automagically appears in XHTML documents | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-110746@lists.php.net to get a copy of this message | ||
From: php at phihag dot de
Operating system: independent
PHP version: 5.2.1
PHP Bug Type: DOM XML related
Bug description: meta tag automagically appears in XHTML documents
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>
--
Edit bug report at http://bugs.php.net/?id=40906&edit=1
--
Try a CVS snapshot (PHP 4.4): http://bugs.php.net/fix.php?id=40906&r=trysnapshot44
Try a CVS snapshot (PHP 5.2): http://bugs.php.net/fix.php?id=40906&r=trysnapshot52
Try a CVS snapshot (PHP 6.0): http://bugs.php.net/fix.php?id=40906&r=trysnapshot60
Fixed in CVS: http://bugs.php.net/fix.php?id=40906&r=fixedcvs
Fixed in release: http://bugs.php.net/fix.php?id=40906&r=alreadyfixed
Need backtrace: http://bugs.php.net/fix.php?id=40906&r=needtrace
Need Reproduce Script: http://bugs.php.net/fix.php?id=40906&r=needscript
Try newer version: http://bugs.php.net/fix.php?id=40906&r=oldversion
Not developer issue: http://bugs.php.net/fix.php?id=40906&r=support
Expected behavior: http://bugs.php.net/fix.php?id=40906&r=notwrong
Not enough info: http://bugs.php.net/fix.php?id=40906&r=notenoughinfo
Submitted twice: http://bugs.php.net/fix.php?id=40906&r=submittedtwice
register_globals: http://bugs.php.net/fix.php?id=40906&r=globals
PHP 3 support discontinued: http://bugs.php.net/fix.php?id=40906&r=php3
Daylight Savings: http://bugs.php.net/fix.php?id=40906&r=dst
IIS Stability: http://bugs.php.net/fix.php?id=40906&r=isapi
Install GNU Sed: http://bugs.php.net/fix.php?id=40906&r=gnused
Floating point limitations: http://bugs.php.net/fix.php?id=40906&r=float
No Zend Extensions: http://bugs.php.net/fix.php?id=40906&r=nozend
MySQL Configuration Error: http://bugs.php.net/fix.php?id=40906&r=mysqlcfg