Req #50989 [Asn->Csd]: LIBXML_NOXMLDECL and xsl:output omit-xml-declaration

From: Date: Sat, 28 Jan 2017 08:29:00 +0000
Subject: Req #50989 [Asn->Csd]: LIBXML_NOXMLDECL and xsl:output omit-xml-declaration
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-206990@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: krakjoe@php.net Reported by: zachatwork at gmail dot com Summary: LIBXML_NOXMLDECL and xsl:output omit-xml-declaration -Status: Assigned +Status: Closed Type: Feature/Change Request Package: DOM XML related Operating System: Debian Linux 5.0.3 PHP Version: * Assigned To: jhdxr Block user comment: N Private report: N New Comment: Automatic comment on behalf of jhdxr Revision: http://git.php.net/?p=php-src.git;a=commit;h=2fcf1259c6a9c1d70bcdfb96aeabc54c47e2a4a0 Log: fixed bug #50989 (DOM support for LIBXML_NOXMLDECL) Previous Comments: ------------------------------------------------------------------------ [2016-10-14 15:27:11] cmb@php.net Related To: Bug #67387 ------------------------------------------------------------------------ [2016-04-30 03:59:36] jhdxr@php.net 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. ------------------------------------------------------------------------ [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 (#206990) next »