| 
        php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login | 
 PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits             
             [2006-05-02 20:32 UTC] rrichards@php.net
  [2006-05-03 08:45 UTC] rrichards@php.net
  | 
    |||||||||||||||||||||||||||
            
                 
                Copyright © 2001-2025 The PHP GroupAll rights reserved.  | 
        Last updated: Tue Nov 04 11:00:01 2025 UTC | 
Description: ------------ Since 5.1.3 you cannot copy a dom object. References still work. The implementation of the xml extension seam to have changed. Reproduce code: --------------- Since 5.1.3 the following code does not work anymore: <?php $dom1 = new DomDocument('1.0', 'UTF-8'); $xml = '<foo />'; $dom1->loadXml($xml); print "<xmp>\n".$dom1->saveXML()."</xmp>\n"; $node = clone $dom1->documentElement; $dom2 = new DomDocument('1.0', 'UTF-8'); $dom2->appendChild($dom2->importNode($node->cloneNode(true), TRUE)); print "<xmp>\n".$dom2->saveXML()."</xmp>\n"; $dom3 = clone $dom1; print "<xmp>\n".$dom3->saveXML()."</xmp>\n"; ?> Expected result: ---------------- <?xml version="1.0"?> <foo/> <?xml version="1.0"?> <foo/> <?xml version="1.0"?> <foo/> Actual result: -------------- <?xml version="1.0"?> <foo/> Warning: DOMNode::cloneNode() [function.DOMNode-cloneNode]: Couldn't fetch DOMElement in /www/content/ spielzeug/xslt/513.php on line 13 Warning: DOMDocument::importNode() expects parameter 1 to be DOMNode, null given in /www/content/ spielzeug/xslt/513.php on line 13 Warning: DOMNode::appendChild() expects parameter 1 to be DOMNode, null given in /www/content/ spielzeug/xslt/513.php on line 13 <?xml version="1.0" encoding="UTF-8"?> Warning: DOMDocument::saveXML() [function.DOMDocument-saveXML]: Couldn't fetch DOMDocument in /www/content/ spielzeug/xslt/513.php on line 19