summaryrefslogtreecommitdiff
path: root/ext/simplexml/tests/bug43221.phpt
blob: bac22775970b9752c4d76ea181472da73fbea820 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
--TEST--
Bug #43221 (SimpleXML adding default namespace in addAttribute)
--SKIPIF--
<?php if (!extension_loaded("simplexml")) print "skip"; ?>
--FILE--
<?php
$xml = simplexml_load_string('<?xml version="1.0" encoding="utf-8"?><root />');
$n = $xml->addChild("node", "value");
$n->addAttribute("a", "b");
$n->addAttribute("c", "d", "http://bar.com");
$n->addAttribute("foo:e", "f", "http://bar.com");
print_r($xml->asXml());
?>
===DONE===
--EXPECTF--
Warning: SimpleXMLElement::addAttribute(): Attribute requires prefix for namespace in %sbug43221.php on line %d
<?xml version="1.0" encoding="utf-8"?>
<root><node xmlns:foo="http://bar.com" a="b" foo:e="f">value</node></root>
===DONE===