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
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: greg dot steffensen at richmond dot edu
New email:
PHP Version: OS:

 

 [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

Pull Requests

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-2025 The PHP Group
All rights reserved.
Last updated: Wed Jul 02 04:01:38 2025 UTC