|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull Requests
Pull requests:
HistoryAllCommentsChangesGit/SVN commits
[2010-11-24 10:09 UTC] jani@php.net
-Package: Feature/Change Request
+Package: DOM XML related
[2016-04-30 03:59 UTC] jhdxr@php.net
-PHP Version: 5.3.1
+PHP Version: *
-Assigned To:
+Assigned To: jhdxr
[2016-04-30 03:59 UTC] jhdxr@php.net
[2017-01-28 08:28 UTC] krakjoe@php.net
[2017-01-28 08:28 UTC] krakjoe@php.net
-Status: Assigned
+Status: Closed
[2017-02-01 19:07 UTC] ab@php.net
[2017-02-01 19:18 UTC] krakjoe@php.net
[2017-02-01 19:24 UTC] ab@php.net
|
|||||||||||||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Fri Oct 24 08:00:01 2025 UTC |
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/>