#40906 [Opn->Bgs]: meta tag automagically appears in XHTML documents

From: Date: Sat, 24 Mar 2007 18:33:44 +0000
Subject: #40906 [Opn->Bgs]: meta tag automagically appears in XHTML documents
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-110756@lists.php.net to get a copy of this message
ID: 40906 Updated by: rrichards@php.net Reported By: php at phihag dot de -Status: Open +Status: Bogus Bug Type: DOM XML related Operating System: independent PHP Version: 5.2.1 New Comment: 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) Previous Comments: ------------------------------------------------------------------------ [2007-03-23 22:58:36] 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> ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=40906&edit=1

« previous php.bugs (#110756) next »