xref: /PHP-7.2/ext/simplexml/tests/bug41947.phpt (revision cfc417af)
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===DONE===
16--EXPECT--
17hello
18===DONE===
19