#37934 [Asn->Bgs]: Unable to create a new DOMDocument with a bogus encoding parameter
| From: | rrichards@php.net | Date: | Mon, 03 Jul 2006 14:01:57 +0000 |
| Subject: | #37934 [Asn->Bgs]: Unable to create a new DOMDocument with a bogus encoding parameter | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-99069@lists.php.net to get a copy of this message | ||
ID: 37934
Updated by: rrichards@php.net
Reported By: z_rules55 at hotmail dot com
-Status: Assigned
+Status: Bogus
Bug Type: DOM XML related
Operating System: Windows XP Pro
PHP Version: 5.1.4
Assigned To: rrichards
New Comment:
Sorry, but your problem does not imply a bug in PHP itself. For a
list of more appropriate places to ask for help using PHP, please
visit http://www.php.net/support.php as this bug system
is not the
appropriate forum for asking support questions. Due to the volume
of reports we can not explain in detail here why your report is not
a bug. The support channels will be able to provide an explanation
for you.
Thank you for your interest in PHP.
document is created. error occurs when trying to serialize it with
bogus encoding. libxml2 bug with its error message - will be fixed
there. to see error use libxml_use_internal_errors(TRUE) and inspect
the structured errors after trying to save.
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