|   | php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login | 
| 
 PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits              [2006-01-23 20:21 UTC] rrichards@php.net
 | |||||||||||||||||||||||||||
|  Copyright © 2001-2025 The PHP Group All rights reserved. | Last updated: Fri Oct 31 16:00:01 2025 UTC | 
Description: ------------ DOMElement::setAttribute() allows one to specify a colon in the attribute name, for example "xsi:type". If an attribute with a matching namespace prefix and local name already exists in the element, the creation of the new attribute will cause two identically-named attributes to exist in the same element. Reproduce code: --------------- $dom = DOMDocument::loadXML("<root xmlns:somens='uri://bla'><element somens:foo='bar' /></root>"); print $dom->firstChild->firstChild->setAttribute('somens:foo', 'baz'); print $dom->saveXML(); Expected result: ---------------- DOMElement::setAttribute() should return FALSE or throw an exception; the DOMDocument should not be changed. Actual result: -------------- <?xml version="1.0"?> <root xmlns:somens="uri://bla"><element somens:foo="bar" somens:foo="baz"/></root>