ID: 49282
Updated by: [email protected]
Reported By: daniel at webdevelopers dot cz
-Status: Open
+Status: Bogus
Bug Type: DOM XML related
Operating System: Ubuntu 2.6.21 i686
PHP Version: 5.3.0
New Comment:
This was a bug in the libxml2 library and fixed there. Will be in the
2.7.7 release
Previous Comments:
------------------------------------------------------------------------
[2009-08-17 16:53:24] daniel at webdevelopers dot cz
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 this bug report at http://bugs.php.net/?id=49282&edit=1