1--TEST-- 2Bug #39662 (Segfault when calling asXML() of a cloned SimpleXMLElement) 3--SKIPIF-- 4<?php if (!extension_loaded("simplexml")) print "skip simplexml extension is not loaded"; ?> 5--FILE-- 6<?php 7 8$xml = '<?xml version="1.0" encoding="utf-8" ?> 9<test> 10 11</test>'; 12 13$root = simplexml_load_string($xml); 14$clone = clone $root; 15var_dump($root); 16var_dump($clone); 17var_dump($clone->asXML()); 18 19echo "Done\n"; 20?> 21--EXPECTF-- 22object(SimpleXMLElement)#%d (0) { 23} 24object(SimpleXMLElement)#%d (0) { 25} 26string(15) "<test> 27 28</test>" 29Done 30