ID: 44814 Updated by: [EMAIL PROTECTED] Reported By: anthony at createvibe dot com -Status: Open +Status: Feedback Bug Type: DOM XML related Operating System: linux PHP Version: 5.2.5 New Comment:
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 Previous Comments: ------------------------------------------------------------------------ [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