From:             info at intelligentstreaming dot com
Operating system: Linux
PHP version:      5.1.2
PHP Bug Type:     DOM XML related
Bug description:  setAttribute() allows colon in attribute name

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 bug report at http://bugs.php.net/?id=36116&edit=1
-- 
Try a CVS snapshot (PHP 4.4): 
http://bugs.php.net/fix.php?id=36116&r=trysnapshot44
Try a CVS snapshot (PHP 5.1): 
http://bugs.php.net/fix.php?id=36116&r=trysnapshot51
Try a CVS snapshot (PHP 6.0): 
http://bugs.php.net/fix.php?id=36116&r=trysnapshot60
Fixed in CVS:                 http://bugs.php.net/fix.php?id=36116&r=fixedcvs
Fixed in release:             
http://bugs.php.net/fix.php?id=36116&r=alreadyfixed
Need backtrace:               http://bugs.php.net/fix.php?id=36116&r=needtrace
Need Reproduce Script:        http://bugs.php.net/fix.php?id=36116&r=needscript
Try newer version:            http://bugs.php.net/fix.php?id=36116&r=oldversion
Not developer issue:          http://bugs.php.net/fix.php?id=36116&r=support
Expected behavior:            http://bugs.php.net/fix.php?id=36116&r=notwrong
Not enough info:              
http://bugs.php.net/fix.php?id=36116&r=notenoughinfo
Submitted twice:              
http://bugs.php.net/fix.php?id=36116&r=submittedtwice
register_globals:             http://bugs.php.net/fix.php?id=36116&r=globals
PHP 3 support discontinued:   http://bugs.php.net/fix.php?id=36116&r=php3
Daylight Savings:             http://bugs.php.net/fix.php?id=36116&r=dst
IIS Stability:                http://bugs.php.net/fix.php?id=36116&r=isapi
Install GNU Sed:              http://bugs.php.net/fix.php?id=36116&r=gnused
Floating point limitations:   http://bugs.php.net/fix.php?id=36116&r=float
No Zend Extensions:           http://bugs.php.net/fix.php?id=36116&r=nozend
MySQL Configuration Error:    http://bugs.php.net/fix.php?id=36116&r=mysqlcfg

Reply via email to