]> granicus.if.org Git - php/commitdiff
satisfy my very first user :)
authorSterling Hughes <sterling@php.net>
Mon, 30 Jun 2003 03:08:48 +0000 (03:08 +0000)
committerSterling Hughes <sterling@php.net>
Mon, 30 Jun 2003 03:08:48 +0000 (03:08 +0000)
ext/simplexml/simplexml.c

index 35fc724c2147171c7a10a91042c897ab4375b848..67e974cedd393f93f2ce83dd6e3da25fee41bc56 100644 (file)
@@ -84,7 +84,18 @@ _node_as_zval(php_sxe_object *sxe, xmlNodePtr node, zval *value TSRMLS_DC)
 static inline int 
 match_ns(php_sxe_object *sxe, xmlNodePtr node, xmlChar *name)
 {
-       if (!xmlStrcmp(node->ns->prefix, name) || !xmlStrcmp((xmlChar *) xmlHashLookup(sxe->nsmap, node->ns->href), name)) {
+       xmlChar *prefix;
+       
+       prefix = xmlHashLookup(sxe->nsmap, node->ns->href);
+       if (prefix == NULL) {
+               prefix = node->ns->prefix;
+       }
+
+       if (prefix == NULL) {
+               return 0;
+       }
+
+       if (!xmlStrcmp(prefix, name)) {
                return 1;
        }
 
@@ -139,7 +150,7 @@ sxe_property_read(zval *object, zval *member TSRMLS_DC)
                if (node->ns) {
                        if (node->parent->ns) {
                                if (!xmlStrcmp(node->ns->href, node->parent->ns->href)) {
-                                       goto next_iter;
+                                       goto this_iter;
                                }
                        }
                        
@@ -150,6 +161,7 @@ sxe_property_read(zval *object, zval *member TSRMLS_DC)
                                goto next_iter;
                        }
                }
+this_iter:
 
                if (!xmlStrcmp(node->name, name)) {
                        APPEND_PREV_ELEMENT(counter, value);