#37934 [NEW]: Unable to create a new DOMDocument with a bogus encoding parameter

From: Date: Tue, 27 Jun 2006 19:56:33 +0000
Subject: #37934 [NEW]: Unable to create a new DOMDocument with a bogus encoding parameter
Groups: php.bugs 
Request: Send a blank email to php-bugs+get-98850@lists.php.net to get a copy of this message
From: z_rules55 at hotmail dot com Operating system: Windows XP Pro PHP version: 5.1.4 PHP Bug Type: DOM XML related Bug description: Unable to create a new DOMDocument with a bogus encoding parameter 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 bug report at http://bugs.php.net/?id=37934&edit=1 -- Try a CVS snapshot (PHP 4.4): http://bugs.php.net/fix.php?id=37934&r=trysnapshot44 Try a CVS snapshot (PHP 5.2): http://bugs.php.net/fix.php?id=37934&r=trysnapshot52 Try a CVS snapshot (PHP 6.0): http://bugs.php.net/fix.php?id=37934&r=trysnapshot60 Fixed in CVS: http://bugs.php.net/fix.php?id=37934&r=fixedcvs Fixed in release: http://bugs.php.net/fix.php?id=37934&r=alreadyfixed Need backtrace: http://bugs.php.net/fix.php?id=37934&r=needtrace Need Reproduce Script: http://bugs.php.net/fix.php?id=37934&r=needscript Try newer version: http://bugs.php.net/fix.php?id=37934&r=oldversion Not developer issue: http://bugs.php.net/fix.php?id=37934&r=support Expected behavior: http://bugs.php.net/fix.php?id=37934&r=notwrong Not enough info: http://bugs.php.net/fix.php?id=37934&r=notenoughinfo Submitted twice: http://bugs.php.net/fix.php?id=37934&r=submittedtwice register_globals: http://bugs.php.net/fix.php?id=37934&r=globals PHP 3 support discontinued: http://bugs.php.net/fix.php?id=37934&r=php3 Daylight Savings: http://bugs.php.net/fix.php?id=37934&r=dst IIS Stability: http://bugs.php.net/fix.php?id=37934&r=isapi Install GNU Sed: http://bugs.php.net/fix.php?id=37934&r=gnused Floating point limitations: http://bugs.php.net/fix.php?id=37934&r=float No Zend Extensions: http://bugs.php.net/fix.php?id=37934&r=nozend MySQL Configuration Error: http://bugs.php.net/fix.php?id=37934&r=mysqlcfg

« previous php.bugs (#98850) next »