xref: /PHP-8.0/ext/simplexml/tests/bug41947.phpt (revision a555cc0b)
1--TEST--
2Bug #41947 (addChild incorrectly registers empty strings as namespaces)
3--SKIPIF--
4<?php if (!extension_loaded("simplexml")) print "skip"; ?>
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