ID:               37934
 Updated by:       [EMAIL PROTECTED]
 Reported By:      z_rules55 at hotmail dot com
-Status:           Open
+Status:           Assigned
 Bug Type:         DOM XML related
 Operating System: Windows XP Pro
 PHP Version:      5.1.4
-Assigned To:      
+Assigned To:      rrichards


Previous Comments:
------------------------------------------------------------------------

[2006-06-27 19:56:33] z_rules55 at hotmail dot com

Description:
------------
Echoing $dom->saveXML() for a freshly created DOMDocument usually
yields an XML declaration, even if the DOMDocument constructor is
passed a bogus XML version parameter. However, nothing (not even an
error message) is printed if I pass a bogus encoding parameter.

If PHP checks to make sure that the encoding parameter is correct, then
shouldn't it also check to make sure the version is correct?

Reproduce code:
---------------
$hi = new DOMDocument();
echo $hi->saveXML();
echo "\n";
$hi = new DOMDocument('1.0', 'utf-8');
echo $hi->saveXML();
echo "\n";
$hi = new DOMDocument('3.14', 'utf-8');
echo $hi->saveXML();
echo "\n";
$hi = new DOMDocument('3.14', 'lkj');
echo $hi->saveXML();
echo "\n";

Expected result:
----------------
<?xml version="1.0"?>
<?xml version="1.0" encoding="utf-8"?>
<?xml version="3.14" encoding="utf-8"?>
<?xml version="3.14" encoding="lkj"?>

Actual result:
--------------
<?xml version="1.0"?>
<?xml version="1.0" encoding="utf-8"?>
<?xml version="3.14" encoding="utf-8"?>
/* Nothing printed for the last line. */


------------------------------------------------------------------------


-- 
Edit this bug report at http://bugs.php.net/?id=37934&edit=1

Reply via email to