#44814 [Opn->Fbk]: cannot properly return DOMDocumentFragment
| From: | jani@php.net | Date: | Thu, 24 Apr 2008 11:09:34 +0000 |
| Subject: | #44814 [Opn->Fbk]: cannot properly return DOMDocumentFragment | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-124467@lists.php.net to get a copy of this message | ||
ID: 44814
Updated by: jani@php.net
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