bug41947.phpt 437 B

12345678910111213141516
  1. --TEST--
  2. Bug #41947 (addChild incorrectly registers empty strings as namespaces)
  3. --EXTENSIONS--
  4. simplexml
  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. $gchild = $xml->xpath("//grandchild");
  10. if (count($gchild) > 0) {
  11. echo $gchild[0]."\n";
  12. }
  13. ?>
  14. --EXPECT--
  15. hello