xref: /PHP-8.1/ext/simplexml/tests/bug41947.phpt (revision 7f2f0c00)
1--TEST--
2Bug #41947 (addChild incorrectly registers empty strings as namespaces)
3--EXTENSIONS--
4simplexml
5--FILE--
6<?php
7$xml = simplexml_load_string('<?xml version="1.0" encoding="utf-8"?><root xmlns:myns="http://myns" />');
8$grandchild = $xml->addChild('child', null, 'http://myns')->addChild('grandchild', 'hello', '');
9
10$gchild = $xml->xpath("//grandchild");
11if (count($gchild) > 0) {
12    echo $gchild[0]."\n";
13}
14?>
15--EXPECT--
16hello
17