From: info at pcxtra dot nl Operating system: Fedora 9 PHP version: 5.2.9 PHP Bug Type: DOM XML related Bug description: SaveXML not well formed
Description: ------------ SaveXML method generates html element with TWO xmlns attributes (which is not well formed XML). Reproduce code: --------------- $html = <<<HTML <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> </head> <body> </body> </html> HTML; $doc = new DOMDocument(); $doc->loadHTML( $html ); $result = $doc->saveXML(); $doc2 = new DOMDocument(); $doc2->loadXML( $result ); $result2 = $doc->saveXML(); echo $result2; Expected result: ---------------- The expected result is: <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> </head> <body> </body> </html> Actual result: -------------- Warning: DOMDocument::loadXML() [function.DOMDocument-loadXML]: Attribute xmlns redefined in Entity, line: 3 in /home/siuser/www/dev/engine/100/test.php on line 21 $result shows two xmlns attributes for the html element: <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" xmlns="http://www.w3.org/1999/xhtml"> <head> </head> <body> </body> </html> -- Edit bug report at http://bugs.php.net/?id=47666&edit=1 -- Try a CVS snapshot (PHP 5.2): http://bugs.php.net/fix.php?id=47666&r=trysnapshot52 Try a CVS snapshot (PHP 5.3): http://bugs.php.net/fix.php?id=47666&r=trysnapshot53 Try a CVS snapshot (PHP 6.0): http://bugs.php.net/fix.php?id=47666&r=trysnapshot60 Fixed in CVS: http://bugs.php.net/fix.php?id=47666&r=fixedcvs Fixed in CVS and need be documented: http://bugs.php.net/fix.php?id=47666&r=needdocs Fixed in release: http://bugs.php.net/fix.php?id=47666&r=alreadyfixed Need backtrace: http://bugs.php.net/fix.php?id=47666&r=needtrace Need Reproduce Script: http://bugs.php.net/fix.php?id=47666&r=needscript Try newer version: http://bugs.php.net/fix.php?id=47666&r=oldversion Not developer issue: http://bugs.php.net/fix.php?id=47666&r=support Expected behavior: http://bugs.php.net/fix.php?id=47666&r=notwrong Not enough info: http://bugs.php.net/fix.php?id=47666&r=notenoughinfo Submitted twice: http://bugs.php.net/fix.php?id=47666&r=submittedtwice register_globals: http://bugs.php.net/fix.php?id=47666&r=globals PHP 4 support discontinued: http://bugs.php.net/fix.php?id=47666&r=php4 Daylight Savings: http://bugs.php.net/fix.php?id=47666&r=dst IIS Stability: http://bugs.php.net/fix.php?id=47666&r=isapi Install GNU Sed: http://bugs.php.net/fix.php?id=47666&r=gnused Floating point limitations: http://bugs.php.net/fix.php?id=47666&r=float No Zend Extensions: http://bugs.php.net/fix.php?id=47666&r=nozend MySQL Configuration Error: http://bugs.php.net/fix.php?id=47666&r=mysqlcfg
