summaryrefslogtreecommitdiff
path: root/ext/xsl/xsltprocessor.c
diff options
context:
space:
mode:
authorRob Richards <rrichards@php.net>2006-12-05 12:04:34 +0000
committerRob Richards <rrichards@php.net>2006-12-05 12:04:34 +0000
commit865f4d75be54756a882f8dd7b2bfa80c483da1db (patch)
tree68b99860878dda2718e989f6d531be8b0a483dc3 /ext/xsl/xsltprocessor.c
parent7389f59f4da24035e46d8a14ef0a55ab10596aee (diff)
downloadphp-git-865f4d75be54756a882f8dd7b2bfa80c483da1db.tar.gz
fix bug #39625 (Apache crashes on importStylesheet call)
Diffstat (limited to 'ext/xsl/xsltprocessor.c')
-rw-r--r--ext/xsl/xsltprocessor.c14
1 files changed, 8 insertions, 6 deletions
diff --git a/ext/xsl/xsltprocessor.c b/ext/xsl/xsltprocessor.c
index 90c4995abb..4d708b11fa 100644
--- a/ext/xsl/xsltprocessor.c
+++ b/ext/xsl/xsltprocessor.c
@@ -384,13 +384,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;