From: [EMAIL PROTECTED] Operating system: Windows Vista PHP version: 5.2.5 PHP Bug Type: DOM XML related Bug description: All-or-nothing for production checks in DOM interface
Description: ------------ libxml2 is fairly lenient when it comes to what it allows to go into its nodes; you can set attributes and tags with illegal characters in them and it won't complain. The burden is on the userland code to perform an appropriate check with the xmlValidate*() functions. PHP's DOM implementation is extremely spotty when it comes to these checks, which allows for some broken XML to easily be generated. For example, $d = new DOMDocument(); $d->appendChild($n = $d->createElement('a')); $n->setAttribute('"@', 'foo'); echo $d->saveXML(); outputs: <?xml version="1.0"?> <a "@="foo"/> Which is clearly incorrect. However, if I attempt to $d->createElement('a@'); DOM complains, because xmlValidateName was called on the element name. Now, I actually don't mind the lack of checking; the DOM tree is useful for things like HTML, where the rules are slightly different from XMLs; an HTML tree can contain a "a@" node, although it would not be valid HTML. (You can try it out for yourself on Firefox by putting that in a document and then inspecting the DOM). However, I want consistency, and I also want the ability to switch on strict checking when I so desire (especially when I'm producing XML). So I want all-or-nothing production checks in PHP DOM, adding another property in DOMDocument (or maybe even a global libxml configuration option) that specifies whether or not strict production checking should be done. -- Edit bug report at http://bugs.php.net/?id=44648&edit=1 -- Try a CVS snapshot (PHP 5.2): http://bugs.php.net/fix.php?id=44648&r=trysnapshot52 Try a CVS snapshot (PHP 5.3): http://bugs.php.net/fix.php?id=44648&r=trysnapshot53 Try a CVS snapshot (PHP 6.0): http://bugs.php.net/fix.php?id=44648&r=trysnapshot60 Fixed in CVS: http://bugs.php.net/fix.php?id=44648&r=fixedcvs Fixed in release: http://bugs.php.net/fix.php?id=44648&r=alreadyfixed Need backtrace: http://bugs.php.net/fix.php?id=44648&r=needtrace Need Reproduce Script: http://bugs.php.net/fix.php?id=44648&r=needscript Try newer version: http://bugs.php.net/fix.php?id=44648&r=oldversion Not developer issue: http://bugs.php.net/fix.php?id=44648&r=support Expected behavior: http://bugs.php.net/fix.php?id=44648&r=notwrong Not enough info: http://bugs.php.net/fix.php?id=44648&r=notenoughinfo Submitted twice: http://bugs.php.net/fix.php?id=44648&r=submittedtwice register_globals: http://bugs.php.net/fix.php?id=44648&r=globals PHP 4 support discontinued: http://bugs.php.net/fix.php?id=44648&r=php4 Daylight Savings: http://bugs.php.net/fix.php?id=44648&r=dst IIS Stability: http://bugs.php.net/fix.php?id=44648&r=isapi Install GNU Sed: http://bugs.php.net/fix.php?id=44648&r=gnused Floating point limitations: http://bugs.php.net/fix.php?id=44648&r=float No Zend Extensions: http://bugs.php.net/fix.php?id=44648&r=nozend MySQL Configuration Error: http://bugs.php.net/fix.php?id=44648&r=mysqlcfg