MFB: fix bug #39625 (Apache crashes on importStylesheet call)

This commit is contained in:
Rob Richards 2006-12-05 12:05:03 +00:00
parent 65f8f45692
commit 5ccef7164e

View File

@ -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;