From: daniel at webdevelopers dot cz Operating system: Ubuntu 2.6.21 i686 PHP version: 5.3.0 PHP Bug Type: DOM XML related Bug description: importNode() looses namespaceURI value
Description: ------------ libxml 2.6.31 When importing previously removed element into the new document the namespaceURI is not preserved. It is preserved only if the @xmlns declaration attribute is present on the element itself. Does not work if it was declared on former ancestor. Reproduce code: --------------- $rcpt=new DOMDocument; $rcpt->loadXML("<rcpt></rcpt>"); // XMLNS on parent $dnr1=new DOMDocument; $dnr1->loadXML("<dnr xmlns:sys='http://www.1stomni.com/spire'><sys:donate/></dnr>"); // XMLNS on element $dnr2=new DOMDocument; $dnr2->loadXML("<dnr><sys:donate xmlns:sys='http://www.1stomni.com/spire'/></dnr>"); getGift($rcpt, $dnr1->documentElement->removeChild($dnr1->documentElement->firstChild)); getGift($rcpt, $dnr2->documentElement->removeChild($dnr2->documentElement->firstChild)); function getGift($dom, $gift) { echo "before: \"$gift->namespaceURI\"; after: \"".$dom->documentElement->appendChild($dom->importNode($gift))->namespaceURI."\"\n"; } Expected result: ---------------- before: "http://www.1stomni.com/spire"; after: "http://www.1stomni.com/spire" before: "http://www.1stomni.com/spire"; after: "http://www.1stomni.com/spire" Actual result: -------------- before: "http://www.1stomni.com/spire"; after: "" before: "http://www.1stomni.com/spire"; after: "http://www.1stomni.com/spire" -- Edit bug report at http://bugs.php.net/?id=49282&edit=1 -- Try a snapshot (PHP 5.2): http://bugs.php.net/fix.php?id=49282&r=trysnapshot52 Try a snapshot (PHP 5.3): http://bugs.php.net/fix.php?id=49282&r=trysnapshot53 Try a snapshot (PHP 6.0): http://bugs.php.net/fix.php?id=49282&r=trysnapshot60 Fixed in SVN: http://bugs.php.net/fix.php?id=49282&r=fixed Fixed in SVN and need be documented: http://bugs.php.net/fix.php?id=49282&r=needdocs Fixed in release: http://bugs.php.net/fix.php?id=49282&r=alreadyfixed Need backtrace: http://bugs.php.net/fix.php?id=49282&r=needtrace Need Reproduce Script: http://bugs.php.net/fix.php?id=49282&r=needscript Try newer version: http://bugs.php.net/fix.php?id=49282&r=oldversion Not developer issue: http://bugs.php.net/fix.php?id=49282&r=support Expected behavior: http://bugs.php.net/fix.php?id=49282&r=notwrong Not enough info: http://bugs.php.net/fix.php?id=49282&r=notenoughinfo Submitted twice: http://bugs.php.net/fix.php?id=49282&r=submittedtwice register_globals: http://bugs.php.net/fix.php?id=49282&r=globals PHP 4 support discontinued: http://bugs.php.net/fix.php?id=49282&r=php4 Daylight Savings: http://bugs.php.net/fix.php?id=49282&r=dst IIS Stability: http://bugs.php.net/fix.php?id=49282&r=isapi Install GNU Sed: http://bugs.php.net/fix.php?id=49282&r=gnused Floating point limitations: http://bugs.php.net/fix.php?id=49282&r=float No Zend Extensions: http://bugs.php.net/fix.php?id=49282&r=nozend MySQL Configuration Error: http://bugs.php.net/fix.php?id=49282&r=mysqlcfg