ID:               44814
 Updated by:       [EMAIL PROTECTED]
 Reported By:      anthony at createvibe dot com
-Status:           Feedback
+Status:           Bogus
 Bug Type:         DOM XML related
 Operating System: linux
 PHP Version:      5.2.5
 New Comment:

Thank you for taking the time to write to us, but this is not
a bug. Please double-check the documentation available at
http://www.php.net/manual/ and the instructions on how to report
a bug at http://bugs.php.net/how-to-report.php

You need to import every node, if you want to use it in another 
document.

$dom->appendChild( $dom->importNode(get_frag(),true) );

works in your example


Previous Comments:
------------------------------------------------------------------------

[2008-04-24 11:09:34] [EMAIL PROTECTED]

Please try using this CVS snapshot:

  http://snaps.php.net/php5.2-latest.tar.gz
 
For Windows (zip):
 
  http://snaps.php.net/win32/php5.2-win32-latest.zip

For Windows (installer):

  http://snaps.php.net/win32/php5.2-win32-installer-latest.msi



------------------------------------------------------------------------

[2008-04-24 04:11:58] anthony at createvibe dot com

Description:
------------
When I create a document fragment via,
DOMDocument::createDocumentFragment() and append child nodes to this
fragment (not sure if the 2nd step is crucial to reproducing this bug),
then try to return the document fragment and then try to append that
fragment to another DOMDocument, I receive a DOMException / Wrong
Document error.

Reproduce code:
---------------
function get_frag()
{
        $dom = new DOMDocument;
        $frag = $dom->createDocumentFragment();
        $frag->appendChild( $dom->createElement('br') );
        return( $frag );
}
$dom = new DOMDocument;
$dom->appendChild( get_frag() );
echo $dom->saveXML();

Expected result:
----------------
<?xml version="1.0"?>
<br/>

Actual result:
--------------
( ! ) DOMException: Wrong Document Error in ... test_bug.php on line
10
Call Stack
#       Time    Memory  Function        Location
1       0.0004  62056   {main}( )       ../test_bug.php:0
2       0.0006  63780   DOMNode->appendChild( class DOMDocumentFragment { }
)       ../test_bug.php:10
Dump $_SERVER

$_SERVER['REQUEST_URI'] =

        

string '/test_bug.php' (length=13)

Variables in local scope (#1)

$dom =

        

object(DOMDocument)[1]



------------------------------------------------------------------------


-- 
Edit this bug report at http://bugs.php.net/?id=44814&edit=1

Reply via email to