#47849 [Opn->Csd]: Non-deep import loses the namespace
| From: | rrichards@php.net | Date: | Tue, 07 Apr 2009 15:36:25 +0000 |
| Subject: | #47849 [Opn->Csd]: Non-deep import loses the namespace | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-135636@lists.php.net to get a copy of this message | ||
ID: 47849
Updated by: rrichards@php.net
Reported By: robin2008 at altruists dot org
-Status: Open
+Status: Closed
Bug Type: DOM XML related
Operating System: Ubuntu
PHP Version: 5.2.9
New Comment:
This bug has been fixed in CVS.
Snapshots of the sources are packaged every three hours; this change
will be in the next snapshot. You can grab the snapshot at
http://snaps.php.net/.
Thank you for the report, and for helping us make PHP better.
Previous Comments:
------------------------------------------------------------------------
[2009-03-31 11:48:32] robin2008 at altruists dot org
Description:
------------
I was expecting importNode to respect namespace
Reproduce code:
---------------
<?php
// PHP 5.2.* namespace bug - importNode doesn't preserve the namespace
if deep=0.
$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('<data xmlns=" http://altruists.org
"/>');
echo 'Dom to import from is'.$fromdom->saveXML().chr(13);
$data= $fromdom->firstChild;
$aDOM->documentElement->appendChild($aDOM->importNode($data));
echo 'Result is '.$aDOM->saveXML();
?>
Expected result:
----------------
The manual says "This function returns a copy of the node to import and
associates it with the current document. " so I was expecting it to
preserve the namespace
Actual result:
--------------
The namespace gets lost.
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=47849&edit=1