From: robin2008 at altruists dot org
Operating system: Ubuntu
PHP version: 5.2.9
PHP Bug Type: DOM XML related
Bug description: Non-deep import loses the namespace
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 bug report at http://bugs.php.net/?id=47849&edit=1
--
Try a CVS snapshot (PHP 5.2):
http://bugs.php.net/fix.php?id=47849&r=trysnapshot52
Try a CVS snapshot (PHP 5.3):
http://bugs.php.net/fix.php?id=47849&r=trysnapshot53
Try a CVS snapshot (PHP 6.0):
http://bugs.php.net/fix.php?id=47849&r=trysnapshot60
Fixed in CVS:
http://bugs.php.net/fix.php?id=47849&r=fixedcvs
Fixed in CVS and need be documented:
http://bugs.php.net/fix.php?id=47849&r=needdocs
Fixed in release:
http://bugs.php.net/fix.php?id=47849&r=alreadyfixed
Need backtrace:
http://bugs.php.net/fix.php?id=47849&r=needtrace
Need Reproduce Script:
http://bugs.php.net/fix.php?id=47849&r=needscript
Try newer version:
http://bugs.php.net/fix.php?id=47849&r=oldversion
Not developer issue:
http://bugs.php.net/fix.php?id=47849&r=support
Expected behavior:
http://bugs.php.net/fix.php?id=47849&r=notwrong
Not enough info:
http://bugs.php.net/fix.php?id=47849&r=notenoughinfo
Submitted twice:
http://bugs.php.net/fix.php?id=47849&r=submittedtwice
register_globals:
http://bugs.php.net/fix.php?id=47849&r=globals
PHP 4 support discontinued: http://bugs.php.net/fix.php?id=47849&r=php4
Daylight Savings: http://bugs.php.net/fix.php?id=47849&r=dst
IIS Stability:
http://bugs.php.net/fix.php?id=47849&r=isapi
Install GNU Sed:
http://bugs.php.net/fix.php?id=47849&r=gnused
Floating point limitations:
http://bugs.php.net/fix.php?id=47849&r=float
No Zend Extensions:
http://bugs.php.net/fix.php?id=47849&r=nozend
MySQL Configuration Error:
http://bugs.php.net/fix.php?id=47849&r=mysqlcfg