summaryrefslogtreecommitdiff
path: root/ext/simplexml/simplexml.c
diff options
context:
space:
mode:
authorAntony Dovgal <tony2001@php.net>2006-08-06 17:41:51 +0000
committerAntony Dovgal <tony2001@php.net>2006-08-06 17:41:51 +0000
commit07b5c8fe2a5f3a3714641c543a9d9e12799ac1bb (patch)
treeaf18d79eade0ad8c4095dd6bc859620b4ed918c8 /ext/simplexml/simplexml.c
parent861c55b41781cc2fd044c1709cba3a9218add754 (diff)
downloadphp-git-07b5c8fe2a5f3a3714641c543a9d9e12799ac1bb.tar.gz
MFH: fix #38347 (Segmentation fault when using foreach with an unknown/empty SimpleXMLElement)
Diffstat (limited to 'ext/simplexml/simplexml.c')
-rw-r--r--ext/simplexml/simplexml.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/ext/simplexml/simplexml.c b/ext/simplexml/simplexml.c
index 22757412ca..7a3a335deb 100644
--- a/ext/simplexml/simplexml.c
+++ b/ext/simplexml/simplexml.c
@@ -195,6 +195,9 @@ static xmlNodePtr sxe_get_element_by_name(php_sxe_object *sxe, xmlNodePtr node,
if (sxe->iter.type == SXE_ITER_ELEMENT) {
orgnode = sxe_find_element_by_name(sxe, node, sxe->iter.name TSRMLS_CC);
+ if (!orgnode) {
+ return NULL;
+ }
node = orgnode->children;
}