|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2006-07-03 14:01 UTC] rrichards@php.net
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Sat Nov 08 08:00:01 2025 UTC |
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. */