Req #50989 [Opn]: LIBXML_NOXMLDECL and xsl:output omit-xml-declaration

From: Date: Sat, 30 Apr 2016 03:59:41 +0000
Subject: Req #50989 [Opn]: LIBXML_NOXMLDECL and xsl:output omit-xml-declaration
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-200840@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=50989&edit=1 ID: 50989 Updated by: jhdxr@php.net Reported by: zachatwork at gmail dot com Summary: LIBXML_NOXMLDECL and xsl:output omit-xml-declaration Status: Open Type: Feature/Change Request Package: DOM XML related Operating System: Debian Linux 5.0.3 -PHP Version: 5.3.1 +PHP Version: * -Assigned To: +Assigned To: jhdxr Block user comment: N Private report: N New Comment: The original implement use xmlDocDumpFormatMemory which does not support XML_SAVE_NO_DECL, I replaced them with xmlsave api so it will be supported after merged. Previous Comments: ------------------------------------------------------------------------ [2010-02-10 07:50:40] zachatwork at gmail dot com Description: ------------ libxml defines a constant LIBXML_NOXMLDECL, however DOMDocument doesn't currently honor this variable. It is an extremely useful/important feature because XHTML with an XML declaration triggers "quirks" mode in IE6. Similarly, XSLTProcessor does not honor the "omit-xml-declaration" attribute of the <xsl:output> element. It would be very useful if support for one or both of these items were added. Reproduce code: --------------- --- From manual page: libxml.constants --- <?php print "PHP_VERSION: ".PHP_VERSION."\n"; print "LIBXML_VERSION: ".LIBXML_VERSION."\n"; print "LIBXML_NOXMLDECL: ".LIBXML_NOXMLDECL."\n"; $dom = new DomDocument(); $dom->loadXML("<foo />"); # This should work but doesn't. print "DOMDocument doesn't honor LIBXML_NOXMLDECL:\n"; print $dom->saveXML(null,LIBXML_NOXMLDECL); # This works, and will still work after the above is fixed. print "Forwards compatible workaround:\n"; $lines = explode("\n", $dom->saveXML(null, LIBXML_NOXMLDECL), 2); if(!preg_match('/^\<\?xml/', $lines[0])) print $lines[0]; print $lines[1]; ?> Expected result: ---------------- PHP_VERSION: 5.3.0 LIBXML_VERSION: 20703 LIBXML_NOXMLDECL: 2 DOMDocument doesn't honor LIBXML_NOXMLDECL: <foo/> Forwards compatible workaround: <foo/> Actual result: -------------- PHP_VERSION: 5.3.0 LIBXML_VERSION: 20703 LIBXML_NOXMLDECL: 2 DOMDocument doesn't honor LIBXML_NOXMLDECL: <?xml version="1.0"?> <foo/> Forwards compatible workaround: <foo/> ------------------------------------------------------------------------ -- Edit this bug report at https://bugs.php.net/bug.php?id=50989&edit=1

« previous php.bugs (#200840) next »