xref: /PHP-8.3/ext/simplexml/tests/bug63575.phpt (revision 7f2f0c00)
1--TEST--
2Bug #63575 (Root elements are not properly cloned)
3--EXTENSIONS--
4simplexml
5--FILE--
6<?php
7$xml = '<a><b></b></a>';
8
9$o1 = new SimpleXMlElement($xml);
10$o2 = clone $o1;
11
12$r = current($o2->xpath('/a'));
13$r->addChild('c', new SimpleXMlElement('<c></c>'));
14
15echo $o1->asXML(), PHP_EOL, $o2->asXML();
16?>
17--EXPECT--
18<?xml version="1.0"?>
19<a><b/></a>
20
21<?xml version="1.0"?>
22<a><b/><c/></a>
23