Package home | Report new bug | New search | Development Roadmap Status: Open | Feedback | All | Closed Since Version 2.0.0RC3

Bug #89 XML attribute names should not be treated as case-insensitive
Submitted: 2003-10-12 19:07 UTC
From: c960657 at hotmail dot com Assigned: davey
Status: Closed Package: XML_Tree
PHP Version: Irrelevant OS: Irrelevant
Roadmaps: (Not assigned)    
Subscription  


 [2003-10-12 19:07 UTC] c960657 at hotmail dot com
Description: ------------ The Node::{get|set}Attribute() functions convert the attribute name to lower case before handling it. In XML attribute names are case-sensitive, i.e. <lorem foo="bar"> and <lorem FOO="bar"> are not equivalent. When called on the element <lorem foo="bar">, $node->getAttribute('FOO') currently returns "bar" which is wrong. Instead it should return NULL.

Comments

 [2004-02-08 18:58 UTC] lsmith
Patch provided by Mika Tuupola: --- Node.php.org 2004-02-06 12:42:38.080016000 +0200 +++ Node.php 2004-02-06 12:42:44.980045000 +0200 @@ -269,8 +269,8 @@ class XML_Tree_Node { */ function getAttribute($name) { - if (isset($this->attributes[strtolower($name)])) { - return $this->attributes[strtolower($name)]; + if (isset($this->attributes[$name])) { + return $this->attributes[$name]; } return null; } @@ -285,7 +285,7 @@ class XML_Tree_Node { */ function setAttribute($name, $value = '') { - $this->attributes[strtolower($name)] = $value; + $this->attributes[$name] = $value; } /** @@ -297,8 +297,8 @@ class XML_Tree_Node { */ function unsetAttribute($name) { - if (isset($this->attributes[strtolower($name)])) { - unset($this->attributes[strtolower($name)]); + if (isset($this->attributes[$name])) { + unset($this->attributes[$name]); } }
 [2004-02-08 18:59 UTC] lsmith
Hmm this looks like a BC break. However 2.0 seems to be in beta with no stable release as of yet. Anyways I am not sure why things where done the way they were. But it looks very deliberate. So all in all maybe an option would be more appropriate?
 [2004-05-15 14:11 UTC] davey
This patch is incorporated in my uber patch, so I'm going to close the bug.