diff options
author | Rob Richards <rrichards@php.net> | 2010-12-27 18:57:49 +0000 |
---|---|---|
committer | Rob Richards <rrichards@php.net> | 2010-12-27 18:57:49 +0000 |
commit | 2479cd6ec9ea9b02e5ed89e17f5e9885cfb6219e (patch) | |
tree | 1c33e957a2e52490810d3edf99163bc2f8fc4f05 /ext/simplexml/simplexml.c | |
parent | 9ec9210fbcec3a106b593894cecd811f158acb8f (diff) | |
download | php-git-2479cd6ec9ea9b02e5ed89e17f5e9885cfb6219e.tar.gz |
fix crash with entity declarations
Diffstat (limited to 'ext/simplexml/simplexml.c')
-rw-r--r-- | ext/simplexml/simplexml.c | 30 |
1 files changed, 16 insertions, 14 deletions
diff --git a/ext/simplexml/simplexml.c b/ext/simplexml/simplexml.c index 12cedfce75..283c903488 100644 --- a/ext/simplexml/simplexml.c +++ b/ext/simplexml/simplexml.c @@ -1099,22 +1099,24 @@ static HashTable * sxe_get_prop_hash(zval *object, int is_debug TSRMLS_DC) /* {{ 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; } } |