cvs: php-src /ext/simplexml php_simplexml.h simplexml.c /ext/simplexml/tests profile12.phpt

From: Date: Fri, 14 Apr 2006 15:15:21 +0000
Subject: cvs: php-src /ext/simplexml php_simplexml.h simplexml.c /ext/simplexml/tests profile12.phpt
Groups: php.cvs 
Request: Send a blank email to php-cvs+get-37805@lists.php.net to get a copy of this message
helly Fri Apr 14 15:15:21 2006 UTC Modified files: /php-src/ext/simplexml php_simplexml.h simplexml.c /php-src/ext/simplexml/tests profile12.phpt Log: - Fix properties access to children() result - Allow access by namespace prefix

http://cvs.php.net/viewcvs.cgi/php-src/ext/simplexml/php_simplexml.h?r1=1.24&r2=1.25&diff_format=u Index: php-src/ext/simplexml/php_simplexml.h diff -u php-src/ext/simplexml/php_simplexml.h:1.24 php-src/ext/simplexml/php_simplexml.h:1.25 --- php-src/ext/simplexml/php_simplexml.h:1.24 Mon Feb 27 13:32:25 2006 +++ php-src/ext/simplexml/php_simplexml.h Fri Apr 14 15:15:21 2006 @@ -16,7 +16,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: php_simplexml.h,v 1.24 2006/02/27 13:32:25 helly Exp $ */ +/* $Id: php_simplexml.h,v 1.25 2006/04/14 15:15:21 helly Exp $ */ #ifndef PHP_SIMPLEXML_H #define PHP_SIMPLEXML_H @@ -69,6 +69,7 @@ struct { char *name; char *nsprefix; + int isprefix; SXE_ITER type; zval *data; } iter; http://cvs.php.net/viewcvs.cgi/php-src/ext/simplexml/simplexml.c?r1=1.205&r2=1.206&diff_format=u Index: php-src/ext/simplexml/simplexml.c diff -u php-src/ext/simplexml/simplexml.c:1.205 php-src/ext/simplexml/simplexml.c:1.206 --- php-src/ext/simplexml/simplexml.c:1.205 Fri Apr 14 14:07:51 2006 +++ php-src/ext/simplexml/simplexml.c Fri Apr 14 15:15:21 2006 @@ -18,7 +18,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: simplexml.c,v 1.205 2006/04/14 14:07:51 helly Exp $ */ +/* $Id: simplexml.c,v 1.206 2006/04/14 15:15:21 helly Exp $ */ #ifdef HAVE_CONFIG_H #include "config.h" @@ -58,7 +58,7 @@ /* {{{ _node_as_zval() */ -static void _node_as_zval(php_sxe_object *sxe, xmlNodePtr node, zval *value, SXE_ITER itertype, char *name, char *prefix TSRMLS_DC) +static void _node_as_zval(php_sxe_object *sxe, xmlNodePtr node, zval *value, SXE_ITER itertype, char *name, char *nsprefix, int isprefix TSRMLS_DC) { php_sxe_object *subnode; @@ -69,8 +69,9 @@ if (name) { subnode->iter.name = xmlStrdup(name); } - if (prefix && *prefix) { - subnode->iter.nsprefix = xmlStrdup(prefix); + if (nsprefix && *nsprefix) { + subnode->iter.nsprefix = xmlStrdup(nsprefix); + subnode->iter.isprefix = isprefix; } php_libxml_increment_node_ptr((php_libxml_node_object *)subnode, node, NULL TSRMLS_CC); @@ -116,13 +117,13 @@ } } -static inline int match_ns(php_sxe_object *sxe, xmlNodePtr node, xmlChar *name) /* {{{ */ +static inline int match_ns(php_sxe_object *sxe, xmlNodePtr node, xmlChar *name, int prefix) /* {{{ */ { if (name == NULL && (node->ns == NULL || node->ns->prefix == NULL)) { return 1; } - if (node->ns && (/*!xmlStrcmp(node->ns->prefix, name) ||*/ !xmlStrcmp(node->ns->href, name))) { + if (node->ns && !xmlStrcmp(prefix ? node->ns->prefix : node->ns->href, name)) { return 1; } @@ -139,7 +140,7 @@ } while (node && nodendx <= offset) { SKIP_TEXT(node) - if (node->type == XML_ELEMENT_NODE && match_ns(sxe, node, sxe->iter.nsprefix)) { + if (node->type == XML_ELEMENT_NODE && match_ns(sxe, node, sxe->iter.nsprefix, sxe->iter.isprefix)) { if (sxe->iter.type == SXE_ITER_CHILD || ( sxe->iter.type == SXE_ITER_ELEMENT && !xmlStrcmp(node->name, sxe->iter.name))) { if (nodendx == offset) { @@ -164,7 +165,7 @@ { while (node) { SKIP_TEXT(node) - if (node->type == XML_ELEMENT_NODE && match_ns(sxe, node, sxe->iter.nsprefix)) { + if (node->type == XML_ELEMENT_NODE && match_ns(sxe, node, sxe->iter.nsprefix, sxe->iter.isprefix)) { if (!xmlStrcmp(node->name, name)) { return node; } @@ -198,7 +199,7 @@ while (node) { SKIP_TEXT(node) - if (node->type == XML_ELEMENT_NODE && match_ns(sxe, node, sxe->iter.nsprefix)) { + if (node->type == XML_ELEMENT_NODE && match_ns(sxe, node, sxe->iter.nsprefix, sxe->iter.isprefix)) { if (!xmlStrcmp(node->name, *name)) { if (1||retnode) { @@ -276,9 +277,9 @@ if (Z_TYPE_P(member) != IS_LONG || sxe->iter.type == SXE_ITER_ATTRLIST) { if (Z_TYPE_P(member) == IS_LONG) { while (attr && nodendx <= Z_LVAL_P(member)) { - if ((!test || !xmlStrcmp(attr->name, sxe->iter.name)) && match_ns(sxe, (xmlNodePtr) attr, sxe->iter.nsprefix)) { + if ((!test || !xmlStrcmp(attr->name, sxe->iter.name)) && match_ns(sxe, (xmlNodePtr) attr, sxe->iter.nsprefix, sxe->iter.isprefix)) { if (nodendx == Z_LVAL_P(member)) { - _node_as_zval(sxe, (xmlNodePtr) attr, return_value, SXE_ITER_NONE, NULL, sxe->iter.nsprefix TSRMLS_CC); + _node_as_zval(sxe, (xmlNodePtr) attr, return_value, SXE_ITER_NONE, NULL, sxe->iter.nsprefix, sxe->iter.isprefix TSRMLS_CC); break; } nodendx++; @@ -287,8 +288,8 @@ } } else { while (attr) { - if ((!test || !xmlStrcmp(attr->name, sxe->iter.name)) && !xmlStrcmp(attr->name, name) && match_ns(sxe, (xmlNodePtr) attr, sxe->iter.nsprefix)) { - _node_as_zval(sxe, (xmlNodePtr) attr, return_value, SXE_ITER_NONE, NULL, sxe->iter.nsprefix TSRMLS_CC); + if ((!test || !xmlStrcmp(attr->name, sxe->iter.name)) && !xmlStrcmp(attr->name, name) && match_ns(sxe, (xmlNodePtr) attr, sxe->iter.nsprefix, sxe->iter.isprefix)) { + _node_as_zval(sxe, (xmlNodePtr) attr, return_value, SXE_ITER_NONE, NULL, sxe->iter.nsprefix, sxe->iter.isprefix TSRMLS_CC); break; } attr = attr->next; @@ -307,7 +308,7 @@ } node = sxe_get_element_by_offset(sxe, Z_LVAL_P(member), node, NULL); if (node) { - _node_as_zval(sxe, node, return_value, SXE_ITER_NONE, NULL, sxe->iter.nsprefix TSRMLS_CC); + _node_as_zval(sxe, node, return_value, SXE_ITER_NONE, NULL, sxe->iter.nsprefix, sxe->iter.isprefix TSRMLS_CC); } } else { #if SXE_ELEMENT_BY_NAME @@ -316,10 +317,10 @@ GET_NODE(sxe, node); node = sxe_get_element_by_name(sxe, node, &name, &newtype TSRMLS_CC); if (node) { - _node_as_zval(sxe, node, return_value, newtype, name, sxe->iter.nsprefix TSRMLS_CC); + _node_as_zval(sxe, node, return_value, newtype, name, sxe->iter.nsprefix, sxe->iter.isprefix TSRMLS_CC); } #else - _node_as_zval(sxe, node, return_value, SXE_ITER_ELEMENT, name, sxe->iter.nsprefix TSRMLS_CC); + _node_as_zval(sxe, node, return_value, SXE_ITER_ELEMENT, name, sxe->iter.nsprefix, sxe->iter.isprefix TSRMLS_CC); #endif } } @@ -495,7 +496,7 @@ if (attribs) { if (Z_TYPE_P(member) == IS_LONG) { while (attr && nodendx <= Z_LVAL_P(member)) { - if ((!test || !xmlStrcmp(attr->name, sxe->iter.name)) && match_ns(sxe, (xmlNodePtr) attr, sxe->iter.nsprefix)) { + if ((!test || !xmlStrcmp(attr->name, sxe->iter.name)) && match_ns(sxe, (xmlNodePtr) attr, sxe->iter.nsprefix, sxe->iter.isprefix)) { if (nodendx == Z_LVAL_P(member)) { is_attr = 1; ++counter; @@ -507,7 +508,7 @@ } } else { while (attr) { - if ((!test || !xmlStrcmp(attr->name, sxe->iter.name)) && !xmlStrcmp(attr->name, name) && match_ns(sxe, (xmlNodePtr) attr, sxe->iter.nsprefix)) { + if ((!test || !xmlStrcmp(attr->name, sxe->iter.name)) && !xmlStrcmp(attr->name, name) && match_ns(sxe, (xmlNodePtr) attr, sxe->iter.nsprefix, sxe->iter.isprefix)) { is_attr = 1; ++counter; break; @@ -615,7 +616,7 @@ name = NULL; } MAKE_STD_ZVAL(return_value); - _node_as_zval(sxe, node, return_value, type, name, sxe->iter.nsprefix TSRMLS_CC); + _node_as_zval(sxe, node, return_value, type, name, sxe->iter.nsprefix, sxe->iter.isprefix TSRMLS_CC); sxe = php_sxe_fetch_object(return_value TSRMLS_CC); sxe->tmp = return_value; @@ -675,7 +676,7 @@ int nodendx = 0; while (attr && nodendx <= Z_LVAL_P(member)) { - if ((!test || !xmlStrcmp(attr->name, sxe->iter.name)) && match_ns(sxe, (xmlNodePtr) attr, sxe->iter.nsprefix)) { + if ((!test || !xmlStrcmp(attr->name, sxe->iter.name)) && match_ns(sxe, (xmlNodePtr) attr, sxe->iter.nsprefix, sxe->iter.isprefix)) { if (nodendx == Z_LVAL_P(member)) { exists = 1; break; @@ -686,7 +687,7 @@ } } else { while (attr) { - if ((!test || !xmlStrcmp(attr->name, sxe->iter.name)) && !xmlStrcmp(attr->name, Z_STRVAL_P(member)) && match_ns(sxe, (xmlNodePtr) attr, sxe->iter.nsprefix)) { + if ((!test || !xmlStrcmp(attr->name, sxe->iter.name)) && !xmlStrcmp(attr->name, Z_STRVAL_P(member)) && match_ns(sxe, (xmlNodePtr) attr, sxe->iter.nsprefix, sxe->iter.isprefix)) { exists = 1; break; } @@ -795,7 +796,7 @@ int nodendx = 0; while (attr && nodendx <= Z_LVAL_P(member)) { - if ((!test || !xmlStrcmp(attr->name, sxe->iter.name)) && match_ns(sxe, (xmlNodePtr) attr, sxe->iter.nsprefix)) { + if ((!test || !xmlStrcmp(attr->name, sxe->iter.name)) && match_ns(sxe, (xmlNodePtr) attr, sxe->iter.nsprefix, sxe->iter.isprefix)) { if (nodendx == Z_LVAL_P(member)) { xmlUnlinkNode((xmlNodePtr) attr); php_libxml_node_free_resource((xmlNodePtr) attr TSRMLS_CC); @@ -808,7 +809,7 @@ } else { while (attr) { anext = attr->next; - if ((!test || !xmlStrcmp(attr->name, sxe->iter.name)) && !xmlStrcmp(attr->name, Z_STRVAL_P(member)) && match_ns(sxe, (xmlNodePtr) attr, sxe->iter.nsprefix)) { + if ((!test || !xmlStrcmp(attr->name, sxe->iter.name)) && !xmlStrcmp(attr->name, Z_STRVAL_P(member)) && match_ns(sxe, (xmlNodePtr) attr, sxe->iter.nsprefix, sxe->iter.isprefix)) { xmlUnlinkNode((xmlNodePtr) attr); php_libxml_node_free_resource((xmlNodePtr) attr TSRMLS_CC); break; @@ -871,7 +872,7 @@ /* {{{ _get_base_node_value() */ -static void _get_base_node_value(php_sxe_object *sxe_ref, xmlNodePtr node, zval **value, char *prefix TSRMLS_DC) +static void _get_base_node_value(php_sxe_object *sxe_ref, xmlNodePtr node, zval **value, char *nsprefix, int isprefix TSRMLS_DC) { php_sxe_object *subnode; xmlChar *contents; @@ -888,8 +889,9 @@ 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); + if (nsprefix && *nsprefix) { + subnode->iter.nsprefix = xmlStrdup(nsprefix); + subnode->iter.isprefix = isprefix; } php_libxml_increment_node_ptr((php_libxml_node_object *)subnode, node, NULL TSRMLS_CC); @@ -961,7 +963,7 @@ zattr = NULL; test = sxe->iter.name && sxe->iter.type == SXE_ITER_ATTRLIST; while (attr) { - if ((!test || !xmlStrcmp(attr->name, sxe->iter.name)) && match_ns(sxe, (xmlNodePtr)attr, sxe->iter.nsprefix)) { + if ((!test || !xmlStrcmp(attr->name, sxe->iter.name)) && match_ns(sxe, (xmlNodePtr)attr, sxe->iter.nsprefix, sxe->iter.isprefix)) { xmlChar *tmp; MAKE_STD_ZVAL(value); @@ -990,7 +992,7 @@ xmlFree(tmp); zend_hash_next_index_insert(rv, &value, sizeof(zval *), NULL); node = NULL; - } else { + } else if (sxe->iter.type != SXE_ITER_CHILD) { node = node->children; } @@ -1009,7 +1011,7 @@ } } - if (node->type == XML_ELEMENT_NODE && (! match_ns(sxe, node, sxe->iter.nsprefix))) { + if (node->type == XML_ELEMENT_NODE && (! match_ns(sxe, node, sxe->iter.nsprefix, sxe->iter.isprefix))) { goto next_iter; } @@ -1020,7 +1022,7 @@ namelen = xmlStrlen(node->name) + 1; } - _get_base_node_value(sxe, node, &value, sxe->iter.nsprefix TSRMLS_CC); + _get_base_node_value(sxe, node, &value, sxe->iter.nsprefix, sxe->iter.isprefix TSRMLS_CC); sxe_properties_add(rv, name, namelen, value TSRMLS_CC); next_iter: @@ -1126,11 +1128,11 @@ * to the parent node. */ if (nodeptr->type == XML_TEXT_NODE) { - _node_as_zval(sxe, nodeptr->parent, value, SXE_ITER_NONE, NULL, NULL TSRMLS_CC); + _node_as_zval(sxe, nodeptr->parent, value, SXE_ITER_NONE, NULL, NULL, 0 TSRMLS_CC); } else if (nodeptr->type == XML_ATTRIBUTE_NODE) { - _node_as_zval(sxe, nodeptr->parent, value, SXE_ITER_ATTRLIST, (char*)nodeptr->name, NULL TSRMLS_CC); + _node_as_zval(sxe, nodeptr->parent, value, SXE_ITER_ATTRLIST, (char*)nodeptr->name, NULL, 0 TSRMLS_CC); } else { - _node_as_zval(sxe, nodeptr, value, SXE_ITER_NONE, NULL, NULL TSRMLS_CC); + _node_as_zval(sxe, nodeptr, value, SXE_ITER_NONE, NULL, NULL, 0 TSRMLS_CC); } add_next_index_zval(return_value, value); @@ -1344,7 +1346,7 @@ } /* }}} */ -/* {{{ proto object SimpleXMLElement::children([string ns]) +/* {{{ proto object SimpleXMLElement::children([string ns [, bool is_prefix]]) Finds children of given node */ SXE_METHOD(children) { @@ -1352,8 +1354,9 @@ char *nsprefix = NULL; int nsprefix_len; xmlNodePtr node; + zend_bool isprefix = 0; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|s!", &nsprefix, &nsprefix_len) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|s!b", &nsprefix, &nsprefix_len, &isprefix) == FAILURE) { return; } @@ -1366,7 +1369,7 @@ GET_NODE(sxe, node); node = php_sxe_get_first_node(sxe, node TSRMLS_CC); - _node_as_zval(sxe, node, return_value, SXE_ITER_CHILD, NULL, nsprefix TSRMLS_CC); + _node_as_zval(sxe, node, return_value, SXE_ITER_CHILD, NULL, nsprefix, isprefix TSRMLS_CC); } /* }}} */ @@ -1388,7 +1391,7 @@ } /* }}} */ -/* {{{ proto array SimpleXMLElement::attributes([string ns]) +/* {{{ proto array SimpleXMLElement::attributes([string ns [, bool is_prefix]]) Identifies an element's attributes */ SXE_METHOD(attributes) { @@ -1396,8 +1399,9 @@ char *nsprefix = NULL; int nsprefix_len; xmlNodePtr node; + zend_bool isprefix = 0; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|s!", &nsprefix, &nsprefix_len) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|s!b", &nsprefix, &nsprefix_len, &isprefix) == FAILURE) { return; } @@ -1410,11 +1414,11 @@ node = php_sxe_get_first_node(sxe, node TSRMLS_CC); - _node_as_zval(sxe, node, return_value, SXE_ITER_ATTRLIST, NULL, nsprefix TSRMLS_CC); + _node_as_zval(sxe, node, return_value, SXE_ITER_ATTRLIST, NULL, nsprefix, isprefix TSRMLS_CC); } /* }}} */ -/* {{{ proto void SimpleXMLElement::addChild(string qName [, string value [,string ns]]) +/* {{{ proto void SimpleXMLElement::addChild(string qName [, string value [, string ns]]) Add Element with optional namespace information */ SXE_METHOD(addChild) { @@ -1461,7 +1465,7 @@ newnode->ns = nsptr; } - _node_as_zval(sxe, newnode, return_value, SXE_ITER_NONE, localname, prefix TSRMLS_CC); + _node_as_zval(sxe, newnode, return_value, SXE_ITER_NONE, localname, prefix, 0 TSRMLS_CC); xmlFree(localname); if (prefix != NULL) { @@ -1816,7 +1820,7 @@ } /* }}} */ -/* {{{ proto simplemxml_element simplexml_load_file(string filename [, string class_name [, int options [, string ns]]]) +/* {{{ proto simplemxml_element simplexml_load_file(string filename [, string class_name [, int options [, string ns [, bool is_prefix]]]]) Load a filename and return a simplexml_element object to allow for processing */ PHP_FUNCTION(simplexml_load_file) { @@ -1828,8 +1832,9 @@ int classname_len = 0, ns_len = 0; long options = 0; zend_class_entry *ce= sxe_class_entry; + zend_bool isprefix = 0; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|sls", &filename, &filename_len, &classname, &classname_len, &options, &ns, &ns_len) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|slsb", &filename, &filename_len, &classname, &classname_len, &options, &ns, &ns_len, &isprefix) == FAILURE) { return; } @@ -1849,6 +1854,7 @@ sxe = php_sxe_object_new(ce TSRMLS_CC); sxe->iter.nsprefix = ns_len ? xmlStrdup(ns) : NULL; + sxe->iter.isprefix = isprefix; php_libxml_increment_doc_ref((php_libxml_node_object *)sxe, docp TSRMLS_CC); php_libxml_increment_node_ptr((php_libxml_node_object *)sxe, xmlDocGetRootElement(docp), NULL TSRMLS_CC); @@ -1857,7 +1863,7 @@ } /* }}} */ -/* {{{ proto simplemxml_element simplexml_load_string(string data [, string class_name [, int options [, string ns]]]) +/* {{{ proto simplemxml_element simplexml_load_string(string data [, string class_name [, int options [, string ns [, bool is_prefix]]]]) Load a string and return a simplexml_element object to allow for processing */ PHP_FUNCTION(simplexml_load_string) { @@ -1869,8 +1875,9 @@ int classname_len = 0, ns_len = 0; long options = 0; zend_class_entry *ce= sxe_class_entry; + zend_bool isprefix = 0; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|sls", &data, &data_len, &classname, &classname_len, &options, &ns, &ns_len) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|slsb", &data, &data_len, &classname, &classname_len, &options, &ns, &ns_len, &isprefix) == FAILURE) { return; } @@ -1890,6 +1897,7 @@ sxe = php_sxe_object_new(ce TSRMLS_CC); sxe->iter.nsprefix = ns_len ? xmlStrdup(ns) : NULL; + sxe->iter.isprefix = isprefix; php_libxml_increment_doc_ref((php_libxml_node_object *)sxe, docp TSRMLS_CC); php_libxml_increment_node_ptr((php_libxml_node_object *)sxe, xmlDocGetRootElement(docp), NULL TSRMLS_CC); @@ -1899,7 +1907,7 @@ /* }}} */ -/* {{{ proto SimpleXMLElement::__construct(string data [, int options [, bool data_is_url [, string ns]]]) +/* {{{ proto SimpleXMLElement::__construct(string data [, int options [, bool data_is_url [, string ns [, bool is_prefix]]]]) SimpleXMLElement constructor */ SXE_METHOD(__construct) { @@ -1908,10 +1916,10 @@ int data_len, *ns_len = 0; xmlDocPtr docp; long options = 0; - zend_bool is_url = 0; + zend_bool is_url = 0, isprefix = 0; php_set_error_handling(EH_THROW, zend_exception_get_default(TSRMLS_C) TSRMLS_CC); - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|lbs", &data, &data_len, &options, &is_url, &ns, &ns_len) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|lbsb", &data, &data_len, &options, &is_url, &ns, &ns_len, &isprefix) == FAILURE) { php_std_error_handling(); return; } @@ -1927,6 +1935,7 @@ } sxe->iter.nsprefix = ns_len ? xmlStrdup(ns) : NULL; + sxe->iter.isprefix = isprefix; php_libxml_increment_doc_ref((php_libxml_node_object *)sxe, docp TSRMLS_CC); php_libxml_increment_node_ptr((php_libxml_node_object *)sxe, xmlDocGetRootElement(docp), NULL TSRMLS_CC); } @@ -1951,18 +1960,19 @@ static xmlNodePtr php_sxe_iterator_fetch(php_sxe_object *sxe, xmlNodePtr node, int use_data TSRMLS_DC) { - char *prefix = sxe->iter.nsprefix; + char *prefix = sxe->iter.nsprefix; + int isprefix = sxe->iter.isprefix; int test_elem = sxe->iter.type == SXE_ITER_ELEMENT && sxe->iter.name; int test_attr = sxe->iter.type == SXE_ITER_ATTRLIST && sxe->iter.name; while (node) { SKIP_TEXT(node); if (sxe->iter.type != SXE_ITER_ATTRLIST && node->type == XML_ELEMENT_NODE) { - if ((!test_elem || !xmlStrcmp(node->name, sxe->iter.name)) && match_ns(sxe, node, prefix)) { + if ((!test_elem || !xmlStrcmp(node->name, sxe->iter.name)) && match_ns(sxe, node, prefix, isprefix)) { break; } } else if (node->type == XML_ATTRIBUTE_NODE) { - if ((!test_attr || !xmlStrcmp(node->name, sxe->iter.name)) && match_ns(sxe, node, prefix)) { + if ((!test_attr || !xmlStrcmp(node->name, sxe->iter.name)) && match_ns(sxe, node, prefix, isprefix)) { break; } } @@ -1972,7 +1982,7 @@ if (node && use_data) { ALLOC_INIT_ZVAL(sxe->iter.data); - _node_as_zval(sxe, node, sxe->iter.data, SXE_ITER_NONE, NULL, sxe->iter.nsprefix TSRMLS_CC); + _node_as_zval(sxe, node, sxe->iter.data, SXE_ITER_NONE, NULL, prefix, isprefix TSRMLS_CC); } return node; @@ -2267,7 +2277,7 @@ { php_info_print_table_start(); php_info_print_table_header(2, "Simplexml support", "enabled"); - php_info_print_table_row(2, "Revision", "$Revision: 1.205 $"); + php_info_print_table_row(2, "Revision", "$Revision: 1.206 $"); php_info_print_table_row(2, "Schema support", #ifdef LIBXML_SCHEMAS_ENABLED "enabled"); http://cvs.php.net/viewcvs.cgi/php-src/ext/simplexml/tests/profile12.phpt?r1=1.2&r2=1.3&diff_format=u Index: php-src/ext/simplexml/tests/profile12.phpt diff -u php-src/ext/simplexml/tests/profile12.phpt:1.2 php-src/ext/simplexml/tests/profile12.phpt:1.3 --- php-src/ext/simplexml/tests/profile12.phpt:1.2 Fri Apr 14 14:11:54 2006 +++ php-src/ext/simplexml/tests/profile12.phpt Fri Apr 14 15:15:21 2006 @@ -34,26 +34,34 @@ ["soap"]=> string(41) "http://schemas.xmlsoap.org/soap/envelope/" } -object(SimpleXMLElement)#%d (0) { +object(SimpleXMLElement)#%s (0) { } -object(SimpleXMLElement)#%d (1) { - ["businessInfo"]=> - object(SimpleXMLElement)#%d (1) { +object(SimpleXMLElement)#%s (1) { + ["businessList"]=> + object(SimpleXMLElement)#%s (2) { ["@attributes"]=> array(1) { - ["businessKey"]=> - string(3) "bla" + ["foo"]=> + string(3) "bar" + } + ["businessInfo"]=> + object(SimpleXMLElement)#%s (1) { + ["@attributes"]=> + array(1) { + ["businessKey"]=> + string(3) "bla" + } } } } -object(SimpleXMLElement)#%d (2) { +object(SimpleXMLElement)#%s (2) { ["@attributes"]=> array(1) { ["foo"]=> string(3) "bar" } ["businessInfo"]=> - object(SimpleXMLElement)#%d (1) { + object(SimpleXMLElement)#%s (1) { ["@attributes"]=> array(1) { ["businessKey"]=> @@ -67,26 +75,34 @@ [u"soap"]=> string(41) "http://schemas.xmlsoap.org/soap/envelope/" } -object(SimpleXMLElement)#%d (0) { +object(SimpleXMLElement)#%s (0) { } -object(SimpleXMLElement)#%d (1) { - [u"businessInfo"]=> - object(SimpleXMLElement)#%d (1) { +object(SimpleXMLElement)#%s (1) { + [u"businessList"]=> + object(SimpleXMLElement)#%s (2) { [u"@attributes"]=> array(1) { - [u"businessKey"]=> - unicode(3) "bla" + [u"foo"]=> + unicode(3) "bar" + } + [u"businessInfo"]=> + object(SimpleXMLElement)#%s (1) { + [u"@attributes"]=> + array(1) { + [u"businessKey"]=> + unicode(3) "bla" + } } } } -object(SimpleXMLElement)#%d (2) { +object(SimpleXMLElement)#%s (2) { [u"@attributes"]=> array(1) { [u"foo"]=> unicode(3) "bar" } [u"businessInfo"]=> - object(SimpleXMLElement)#%d (1) { + object(SimpleXMLElement)#%s (1) { [u"@attributes"]=> array(1) { [u"businessKey"]=>
« previous php.cvs (#37805) next »