diff options
author | Rob Richards <rrichards@php.net> | 2005-08-31 17:00:22 +0000 |
---|---|---|
committer | Rob Richards <rrichards@php.net> | 2005-08-31 17:00:22 +0000 |
commit | af7f90f6c7f2ec3236caf3d212cb6b53f9ea7684 (patch) | |
tree | 70e417d3272d7ccba4923a65ff48f3802bdb0623 | |
parent | 39e0c382dfcbf9aed740837505cb08b26677678d (diff) | |
download | php-git-af7f90f6c7f2ec3236caf3d212cb6b53f9ea7684.tar.gz |
make sxe_properties_get respect namespace scope
-rw-r--r-- | ext/simplexml/simplexml.c | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/ext/simplexml/simplexml.c b/ext/simplexml/simplexml.c index 0f168af855..3aa725d581 100644 --- a/ext/simplexml/simplexml.c +++ b/ext/simplexml/simplexml.c @@ -642,7 +642,7 @@ static void sxe_dimension_delete(zval *object, zval *offset TSRMLS_DC) /* {{{ _get_base_node_value() */ static void -_get_base_node_value(php_sxe_object *sxe_ref, xmlNodePtr node, zval **value TSRMLS_DC) +_get_base_node_value(php_sxe_object *sxe_ref, xmlNodePtr node, zval **value, char *prefix TSRMLS_DC) { php_sxe_object *subnode; xmlChar *contents; @@ -659,6 +659,9 @@ _get_base_node_value(php_sxe_object *sxe_ref, xmlNodePtr node, zval **value TSRM subnode = php_sxe_object_new(sxe_ref->zo.ce TSRMLS_CC); subnode->document = sxe_ref->document; subnode->document->refcount++; + if (prefix) { + subnode->iter.nsprefix = xmlStrdup(prefix); + } php_libxml_increment_node_ptr((php_libxml_node_object *)subnode, node, NULL TSRMLS_CC); (*value)->type = IS_OBJECT; @@ -712,6 +715,10 @@ sxe_properties_get(zval *object TSRMLS_DC) } } + if (node->type == XML_ELEMENT_NODE && (! match_ns(sxe, node, sxe->iter.nsprefix))) { + goto next_iter; + } + name = (char *) node->name; if (!name) { goto next_iter; @@ -719,7 +726,7 @@ sxe_properties_get(zval *object TSRMLS_DC) namelen = xmlStrlen(node->name) + 1; } - _get_base_node_value(sxe, node, &value TSRMLS_CC); + _get_base_node_value(sxe, node, &value, sxe->iter.nsprefix TSRMLS_CC); h = zend_hash_func(name, namelen); if (zend_hash_quick_find(rv, name, namelen, h, (void **) &data_ptr) == SUCCESS) { |