summaryrefslogtreecommitdiff
path: root/ext/simplexml
diff options
context:
space:
mode:
authorRob Richards <rrichards@php.net>2010-12-27 18:57:49 (GMT)
committerRob Richards <rrichards@php.net>2010-12-27 18:57:49 (GMT)
commit8bd6c63f6610addd8e68fa52dbea8668e7b4b4d4 (patch)
tree6cd8d00acd5e1f7cb40bce8e4fe21d87b642788a /ext/simplexml
parent610bb960361a4d0bde6ca589bd7163bd6bfccb65 (diff)
downloadphp-8bd6c63f6610addd8e68fa52dbea8668e7b4b4d4.tar.gz
fix crash with entity declarations
Diffstat (limited to 'ext/simplexml')
-rw-r--r--ext/simplexml/simplexml.c30
1 files changed, 16 insertions, 14 deletions
diff --git a/ext/simplexml/simplexml.c b/ext/simplexml/simplexml.c
index 5a58751..ba61dea 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;
}
}