|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #39662 Segfault when calling asXML() of a cloned SimpleXMLElement
Submitted: 2006-11-28 16:16 UTC Modified: 2006-11-28 18:59 UTC
Avg. Score:4.0 ± 1.0
Reproduced:2 of 2 (100.0%)
Same Version:0 (0.0%)
Same OS:0 (0.0%)
From: alexiev at gmail dot com Assigned: tony2001 (profile)
Status: Closed Package: SimpleXML related
PHP Version: 5.2.0 OS: Debian Unstable 2.6.16-2-686
Private report: No CVE-ID: None
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
Block user comment
Status: Assign to:
Bug Type:
From: alexiev at gmail dot com
New email:
PHP Version: OS:


 [2006-11-28 16:16 UTC] alexiev at gmail dot com
When calling asXML() to a cloned element, the php segfaults. I've got no debug information, but the bug is easy to reproduce. I had this problem with PHP 5.2.0 and PHP 5.1.6. With PHP 5.1.2 everything is OK. 

The xml file is just an example - this happens with every xml file I tried!

Reproduce code:
alexiev-home:~/tests# cat SimpleXML.xml
<?xml version="1.0" encoding="utf-8" ?>

alexiev-home:~/tests# cat SimpleXML.php
$root = simplexml_load_file('SimpleXML.xml');
$clone = clone $root;
echo $clone->asXML(); // Segfault here

Expected result:
object(SimpleXMLElement)#1 (1) {
  string(2) "

object(SimpleXMLElement)#2 (1) {
  string(2) "

string(55) "<?xml version="1.0" encoding="utf-8"?>


Actual result:
object(SimpleXMLElement)#1 (1) {
  string(2) "

object(SimpleXMLElement)#2 (1) {
  string(2) "

Segmentation fault


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2006-11-28 18:59 UTC]
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
Thank you for the report, and for helping us make PHP better.

PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Fri Jul 19 00:01:29 2024 UTC