|   | php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login | 
| 
 PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits              [2009-04-07 15:36 UTC] rrichards@php.net
 | |||||||||||||||||||||||||||||||||||||
|  Copyright © 2001-2025 The PHP Group All rights reserved. | Last updated: Fri Oct 31 09:00:01 2025 UTC | 
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.