#36116 [Opn->Bgs]: setAttribute() allows colon in attribute name
| From: | rrichards@php.net | Date: | Mon, 23 Jan 2006 19:21:35 +0000 |
| Subject: | #36116 [Opn->Bgs]: setAttribute() allows colon in attribute name | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-92393@lists.php.net to get a copy of this message | ||
ID: 36116
Updated by: rrichards@php.net
Reported By: info at intelligentstreaming dot com
-Status: Open
+Status: Bogus
Bug Type: DOM XML related
Operating System: Linux
PHP Version: 5.1.2
New Comment:
Thank you for taking the time to write to us, but this is not
a bug. Please double-check the documentation available at
http://www.php.net/manual/ and the instructions on how to
report
a bug at http://bugs.php.net/how-to-report.php
you are mixing DOM level 1 functionality with namespaced document. DOM
specs will tell you that results will be unexpected when doing this.
Previous Comments:
------------------------------------------------------------------------
[2006-01-21 18:30:42] info at intelligentstreaming dot com
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>
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=36116&edit=1