php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #27436 dom_import_simplexml innaccurate
Submitted: 2004-02-29 03:44 UTC Modified: 2004-03-01 07:39 UTC
From: greg dot steffensen at richmond dot edu Assigned:
Status: Closed Package: XML related
PHP Version: 5.0.0b4 (beta4) OS: Windows XP Service Pack 1
Private report: No CVE-ID: None
 [2004-02-29 03:44 UTC] greg dot steffensen at richmond dot edu
Description:
------------
dom_import_simplexml(), when given a simplexml_element that is part of a larger simplexml nesting, will import the parent of the element provided, not the element itself.  

Reproduce code:
---------------
<?
$dom = new domdocument;
$s = simplexml_load_string('<a>Foo<b>Bar<c/></b></a>');
$el = dom_import_simplexml($s->b->c);
$el = $dom->importNode($el, TRUE);
$dom->appendChild($el);
print $dom->saveXML();
?>


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

Actual result:
--------------
<?xml version="1.0"?>
<b>Bar<c/></b>


Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2004-03-01 07:39 UTC] rrichards@php.net
This bug has been fixed in CVS.

Snapshots of the sources are packaged every three hours; this change
will be in the next snapshot. You can grab the snapshot at
http://snaps.php.net/.
 
Thank you for the report, and for helping us make PHP better.


 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Tue Apr 23 10:01:29 2024 UTC