From: Rob Richards Date: Tue, 5 Dec 2006 12:05:03 +0000 (+0000) Subject: MFB: fix bug #39625 (Apache crashes on importStylesheet call) X-Git-Tag: RELEASE_1_0_0RC1~812 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=5ccef7164eb0b0c47cd252c0d8b6f20d5e92e409;p=php MFB: fix bug #39625 (Apache crashes on importStylesheet call) --- diff --git a/ext/xsl/xsltprocessor.c b/ext/xsl/xsltprocessor.c index 103ece66d5..db18723aeb 100644 --- a/ext/xsl/xsltprocessor.c +++ b/ext/xsl/xsltprocessor.c @@ -385,13 +385,15 @@ PHP_FUNCTION(xsl_xsltprocessor_import_stylesheet) efree(member); if (clone_docu == 0) { /* check if the stylesheet is using xsl:key, if yes, we have to clone the document _always_ before a transformation */ - nodep = xmlDocGetRootElement(sheetp->doc)->children; - while (nodep) { - if (nodep->type == XML_ELEMENT_NODE && xmlStrEqual(nodep->name, "key") && xmlStrEqual(nodep->ns->href, XSLT_NAMESPACE)) { - intern->hasKeys = 1; - break; + nodep = xmlDocGetRootElement(sheetp->doc); + if (nodep && (nodep = nodep->children)) { + while (nodep) { + if (nodep->type == XML_ELEMENT_NODE && xmlStrEqual(nodep->name, "key") && xmlStrEqual(nodep->ns->href, XSLT_NAMESPACE)) { + intern->hasKeys = 1; + break; + } + nodep = nodep->next; } - nodep = nodep->next; } } else { intern->hasKeys = clone_docu;