xref: /PHP-7.2/ext/simplexml/tests/bug43221.phpt (revision f1d7e3ca)
1--TEST--
2Bug #43221 (SimpleXML adding default namespace in addAttribute)
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 />');
8$n = $xml->addChild("node", "value");
9$n->addAttribute("a", "b");
10$n->addAttribute("c", "d", "http://bar.com");
11$n->addAttribute("foo:e", "f", "http://bar.com");
12print_r($xml->asXml());
13?>
14===DONE===
15--EXPECTF--
16Warning: SimpleXMLElement::addAttribute(): Attribute requires prefix for namespace in %sbug43221.php on line %d
17<?xml version="1.0" encoding="utf-8"?>
18<root><node xmlns:foo="http://bar.com" a="b" foo:e="f">value</node></root>
19===DONE===
20
21