From: zachatwork at gmail dot com
Operating system: Debian Linux 5.0.3
PHP version: 5.3.1
PHP Bug Type: Feature/Change Request
Bug description: LIBXML_NOXMLDECL and xsl:output omit-xml-declaration
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 bug report at http://bugs.php.net/?id=50989&edit=1
--
Try a snapshot (PHP 5.2):
http://bugs.php.net/fix.php?id=50989&r=trysnapshot52
Try a snapshot (PHP 5.3):
http://bugs.php.net/fix.php?id=50989&r=trysnapshot53
Try a snapshot (PHP 6.0):
http://bugs.php.net/fix.php?id=50989&r=trysnapshot60
Fixed in SVN:
http://bugs.php.net/fix.php?id=50989&r=fixed
Fixed in SVN and need be documented:
http://bugs.php.net/fix.php?id=50989&r=needdocs
Fixed in release:
http://bugs.php.net/fix.php?id=50989&r=alreadyfixed
Need backtrace:
http://bugs.php.net/fix.php?id=50989&r=needtrace
Need Reproduce Script:
http://bugs.php.net/fix.php?id=50989&r=needscript
Try newer version:
http://bugs.php.net/fix.php?id=50989&r=oldversion
Not developer issue:
http://bugs.php.net/fix.php?id=50989&r=support
Expected behavior:
http://bugs.php.net/fix.php?id=50989&r=notwrong
Not enough info:
http://bugs.php.net/fix.php?id=50989&r=notenoughinfo
Submitted twice:
http://bugs.php.net/fix.php?id=50989&r=submittedtwice
register_globals:
http://bugs.php.net/fix.php?id=50989&r=globals
PHP 4 support discontinued: http://bugs.php.net/fix.php?id=50989&r=php4
Daylight Savings: http://bugs.php.net/fix.php?id=50989&r=dst
IIS Stability:
http://bugs.php.net/fix.php?id=50989&r=isapi
Install GNU Sed:
http://bugs.php.net/fix.php?id=50989&r=gnused
Floating point limitations:
http://bugs.php.net/fix.php?id=50989&r=float
No Zend Extensions:
http://bugs.php.net/fix.php?id=50989&r=nozend
MySQL Configuration Error:
http://bugs.php.net/fix.php?id=50989&r=mysqlcfg