svn: /php/php-src/ branches/PHP_5_3/ext/simplexml/simplexml.c trunk/ext/simplexml/simplexml.c

From: Date: Mon, 27 Dec 2010 18:57:49 +0000
Subject: svn: /php/php-src/ branches/PHP_5_3/ext/simplexml/simplexml.c trunk/ext/simplexml/simplexml.c
Groups: php.cvs 
Request: Send a blank email to php-cvs+get-64219@lists.php.net to get a copy of this message
rrichards Mon, 27 Dec 2010 18:57:49 +0000 Revision: http://svn.php.net/viewvc?view=revision&revision=306759 Log: fix crash with entity declarations Changed paths: U php/php-src/branches/PHP_5_3/ext/simplexml/simplexml.c U php/php-src/trunk/ext/simplexml/simplexml.c Modified: php/php-src/branches/PHP_5_3/ext/simplexml/simplexml.c =================================================================== --- php/php-src/branches/PHP_5_3/ext/simplexml/simplexml.c 2010-12-27 17:17:43 UTC (rev 306758) +++ php/php-src/branches/PHP_5_3/ext/simplexml/simplexml.c 2010-12-27 18:57:49 UTC (rev 306759) @@ -1099,22 +1099,24 @@ if (sxe->iter.type == SXE_ITER_ELEMENT) { node = php_sxe_get_first_node(sxe, node TSRMLS_CC); } - attr = node ? (xmlAttrPtr)node->properties : NULL; - 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, sxe->iter.isprefix)) { - MAKE_STD_ZVAL(value); - ZVAL_STRING(value, sxe_xmlNodeListGetString((xmlDocPtr) sxe->document->ptr, attr->children, 1), 0); - namelen = xmlStrlen(attr->name) + 1; - if (!zattr) { - MAKE_STD_ZVAL(zattr); - array_init(zattr); - sxe_properties_add(rv, "@attributes", sizeof("@attributes"), zattr TSRMLS_CC); + if (node->tpye != XML_ENTITY_DECL) { + attr = node ? (xmlAttrPtr)node->properties : NULL; + 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, sxe->iter.isprefix)) { + MAKE_STD_ZVAL(value); + ZVAL_STRING(value, sxe_xmlNodeListGetString((xmlDocPtr) sxe->document->ptr, attr->children, 1), 0); + namelen = xmlStrlen(attr->name) + 1; + if (!zattr) { + MAKE_STD_ZVAL(zattr); + array_init(zattr); + sxe_properties_add(rv, "@attributes", sizeof("@attributes"), zattr TSRMLS_CC); + } + add_assoc_zval_ex(zattr, (char*)attr->name, namelen, value); } - add_assoc_zval_ex(zattr, (char*)attr->name, namelen, value); + attr = attr->next; } - attr = attr->next; } } Modified: php/php-src/trunk/ext/simplexml/simplexml.c =================================================================== --- php/php-src/trunk/ext/simplexml/simplexml.c 2010-12-27 17:17:43 UTC (rev 306758) +++ php/php-src/trunk/ext/simplexml/simplexml.c 2010-12-27 18:57:49 UTC (rev 306759) @@ -1099,22 +1099,24 @@ if (sxe->iter.type == SXE_ITER_ELEMENT) { node = php_sxe_get_first_node(sxe, node TSRMLS_CC); } - attr = node ? (xmlAttrPtr)node->properties : NULL; - 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, sxe->iter.isprefix)) { - MAKE_STD_ZVAL(value); - ZVAL_STRING(value, sxe_xmlNodeListGetString((xmlDocPtr) sxe->document->ptr, attr->children, 1), 0); - namelen = xmlStrlen(attr->name) + 1; - if (!zattr) { - MAKE_STD_ZVAL(zattr); - array_init(zattr); - sxe_properties_add(rv, "@attributes", sizeof("@attributes"), zattr TSRMLS_CC); + if (node->tpye != XML_ENTITY_DECL) { + attr = node ? (xmlAttrPtr)node->properties : NULL; + 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, sxe->iter.isprefix)) { + MAKE_STD_ZVAL(value); + ZVAL_STRING(value, sxe_xmlNodeListGetString((xmlDocPtr) sxe->document->ptr, attr->children, 1), 0); + namelen = xmlStrlen(attr->name) + 1; + if (!zattr) { + MAKE_STD_ZVAL(zattr); + array_init(zattr); + sxe_properties_add(rv, "@attributes", sizeof("@attributes"), zattr TSRMLS_CC); + } + add_assoc_zval_ex(zattr, (char*)attr->name, namelen, value); } - add_assoc_zval_ex(zattr, (char*)attr->name, namelen, value); + attr = attr->next; } - attr = attr->next; } }

« previous php.cvs (#64219) next »