xref: /PHP-5.6/ext/simplexml/tests/bug39662.phpt (revision d5d1801d)
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 (1) {
23  [0]=>
24  string(2) "
25
26"
27}
28object(SimpleXMLElement)#%d (1) {
29  [0]=>
30  string(2) "
31
32"
33}
34string(15) "<test>
35
36</test>"
37Done
38