From: anthony at createvibe dot com Operating system: linux PHP version: 5.2.5 PHP Bug Type: DOM XML related Bug description: cannot properly return DOMDocumentFragment
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 bug report at http://bugs.php.net/?id=44814&edit=1 -- Try a CVS snapshot (PHP 5.2): http://bugs.php.net/fix.php?id=44814&r=trysnapshot52 Try a CVS snapshot (PHP 5.3): http://bugs.php.net/fix.php?id=44814&r=trysnapshot53 Try a CVS snapshot (PHP 6.0): http://bugs.php.net/fix.php?id=44814&r=trysnapshot60 Fixed in CVS: http://bugs.php.net/fix.php?id=44814&r=fixedcvs Fixed in release: http://bugs.php.net/fix.php?id=44814&r=alreadyfixed Need backtrace: http://bugs.php.net/fix.php?id=44814&r=needtrace Need Reproduce Script: http://bugs.php.net/fix.php?id=44814&r=needscript Try newer version: http://bugs.php.net/fix.php?id=44814&r=oldversion Not developer issue: http://bugs.php.net/fix.php?id=44814&r=support Expected behavior: http://bugs.php.net/fix.php?id=44814&r=notwrong Not enough info: http://bugs.php.net/fix.php?id=44814&r=notenoughinfo Submitted twice: http://bugs.php.net/fix.php?id=44814&r=submittedtwice register_globals: http://bugs.php.net/fix.php?id=44814&r=globals PHP 4 support discontinued: http://bugs.php.net/fix.php?id=44814&r=php4 Daylight Savings: http://bugs.php.net/fix.php?id=44814&r=dst IIS Stability: http://bugs.php.net/fix.php?id=44814&r=isapi Install GNU Sed: http://bugs.php.net/fix.php?id=44814&r=gnused Floating point limitations: http://bugs.php.net/fix.php?id=44814&r=float No Zend Extensions: http://bugs.php.net/fix.php?id=44814&r=nozend MySQL Configuration Error: http://bugs.php.net/fix.php?id=44814&r=mysqlcfg