From: alexiev at gmail dot com
Operating system: Debian Unsable 2.6.16-2-686
PHP version: 5.2.0
PHP Bug Type: SimpleXML related
Bug description: Segfault when calling asXML() to a cloned SimpleXMLElement
Description:
------------
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" ?>
<test>
</test>
alexiev-home:~/tests# cat SimpleXML.php
<?php
$root = simplexml_load_file('SimpleXML.xml');
$clone = clone $root;
var_dump($root);
var_dump($clone);
echo $clone->asXML(); // Segfault here
?>
Expected result:
----------------
object(SimpleXMLElement)#1 (1) {
[0]=>
string(2) "
"
}
object(SimpleXMLElement)#2 (1) {
[0]=>
string(2) "
"
}
string(55) "<?xml version="1.0" encoding="utf-8"?>
<test>
</test>
"
Actual result:
--------------
object(SimpleXMLElement)#1 (1) {
[0]=>
string(2) "
"
}
object(SimpleXMLElement)#2 (1) {
[0]=>
string(2) "
"
}
Segmentation fault
--
Edit bug report at http://bugs.php.net/?id=39662&edit=1
--
Try a CVS snapshot (PHP 4.4):
http://bugs.php.net/fix.php?id=39662&r=trysnapshot44
Try a CVS snapshot (PHP 5.2):
http://bugs.php.net/fix.php?id=39662&r=trysnapshot52
Try a CVS snapshot (PHP 6.0):
http://bugs.php.net/fix.php?id=39662&r=trysnapshot60
Fixed in CVS: http://bugs.php.net/fix.php?id=39662&r=fixedcvs
Fixed in release:
http://bugs.php.net/fix.php?id=39662&r=alreadyfixed
Need backtrace: http://bugs.php.net/fix.php?id=39662&r=needtrace
Need Reproduce Script: http://bugs.php.net/fix.php?id=39662&r=needscript
Try newer version: http://bugs.php.net/fix.php?id=39662&r=oldversion
Not developer issue: http://bugs.php.net/fix.php?id=39662&r=support
Expected behavior: http://bugs.php.net/fix.php?id=39662&r=notwrong
Not enough info:
http://bugs.php.net/fix.php?id=39662&r=notenoughinfo
Submitted twice:
http://bugs.php.net/fix.php?id=39662&r=submittedtwice
register_globals: http://bugs.php.net/fix.php?id=39662&r=globals
PHP 3 support discontinued: http://bugs.php.net/fix.php?id=39662&r=php3
Daylight Savings: http://bugs.php.net/fix.php?id=39662&r=dst
IIS Stability: http://bugs.php.net/fix.php?id=39662&r=isapi
Install GNU Sed: http://bugs.php.net/fix.php?id=39662&r=gnused
Floating point limitations: http://bugs.php.net/fix.php?id=39662&r=float
No Zend Extensions: http://bugs.php.net/fix.php?id=39662&r=nozend
MySQL Configuration Error: http://bugs.php.net/fix.php?id=39662&r=mysqlcfg