#37934 [Opn->Asn]: Unable to create a new DOMDocument with a bogus encoding parameter

From: Date: Wed, 28 Jun 2006 08:04:57 +0000
Subject: #37934 [Opn->Asn]: 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-98879@lists.php.net to get a copy of this message
ID: 37934 Updated by: tony2001@php.net 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

« previous php.bugs (#98879) next »