From: robin2008 at altruists dot org Operating system: Ubuntu PHP version: 5.2.9 PHP Bug Type: DOM XML related Bug description: importNode loses the namespace of an XML element.
Description: ------------ ImportNode don't treat namespace properly Reproduce code: --------------- <?php // PHP 5.2.* namespace bug - A namespaced node loses its namespace on import if // (i) It has @xmlns="" // (ii) A namespaceURI of its parent's @xmlns $aDOM= new DOMDocument(); $aDOM->appendChild($aDOM->createElementNS(' http://friend2friend.net ','f2f:a')); echo 'DOM to add into is '.$aDOM->saveXML().chr(13); $fromdom= DOMDocument::loadXML('<?xml version="1.0"?><f2f:data xmlns:f2f=" http://friend2friend.net "><f2f:servicereq xmlns=" http://friend2friend.net "> <f2f:WATCH-MY-NAMESPACE xmlns=""/></f2f:servicereq></f2f:data> '); echo 'Dom to import from is'.$fromdom->saveXML().chr(13); $imported= $aDOM->importNode($fromdom->firstChild->firstChild, 1); $aDOM->appendChild($imported); echo 'Result is '.$aDOM->saveXML(); ?> Expected result: ---------------- Namespace should be preserved Actual result: -------------- Namespace gets lost -- Edit bug report at http://bugs.php.net/?id=47847&edit=1 -- Try a CVS snapshot (PHP 5.2): http://bugs.php.net/fix.php?id=47847&r=trysnapshot52 Try a CVS snapshot (PHP 5.3): http://bugs.php.net/fix.php?id=47847&r=trysnapshot53 Try a CVS snapshot (PHP 6.0): http://bugs.php.net/fix.php?id=47847&r=trysnapshot60 Fixed in CVS: http://bugs.php.net/fix.php?id=47847&r=fixedcvs Fixed in CVS and need be documented: http://bugs.php.net/fix.php?id=47847&r=needdocs Fixed in release: http://bugs.php.net/fix.php?id=47847&r=alreadyfixed Need backtrace: http://bugs.php.net/fix.php?id=47847&r=needtrace Need Reproduce Script: http://bugs.php.net/fix.php?id=47847&r=needscript Try newer version: http://bugs.php.net/fix.php?id=47847&r=oldversion Not developer issue: http://bugs.php.net/fix.php?id=47847&r=support Expected behavior: http://bugs.php.net/fix.php?id=47847&r=notwrong Not enough info: http://bugs.php.net/fix.php?id=47847&r=notenoughinfo Submitted twice: http://bugs.php.net/fix.php?id=47847&r=submittedtwice register_globals: http://bugs.php.net/fix.php?id=47847&r=globals PHP 4 support discontinued: http://bugs.php.net/fix.php?id=47847&r=php4 Daylight Savings: http://bugs.php.net/fix.php?id=47847&r=dst IIS Stability: http://bugs.php.net/fix.php?id=47847&r=isapi Install GNU Sed: http://bugs.php.net/fix.php?id=47847&r=gnused Floating point limitations: http://bugs.php.net/fix.php?id=47847&r=float No Zend Extensions: http://bugs.php.net/fix.php?id=47847&r=nozend MySQL Configuration Error: http://bugs.php.net/fix.php?id=47847&r=mysqlcfg