1--TEST-- 2Bug #43221 (SimpleXML adding default namespace in addAttribute) 3--EXTENSIONS-- 4simplexml 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--EXPECTF-- 15Warning: SimpleXMLElement::addAttribute(): Attribute requires prefix for namespace in %sbug43221.php on line %d 16<?xml version="1.0" encoding="utf-8"?> 17<root><node xmlns:foo="http://bar.com" a="b" foo:e="f">value</node></root> 18 19