rrichards               Tue Dec  5 12:05:03 2006 UTC

  Modified files:              
    /php-src/ext/xsl    xsltprocessor.c 
  Log:
  MFB: fix bug #39625 (Apache crashes on importStylesheet call)
  
http://cvs.php.net/viewvc.cgi/php-src/ext/xsl/xsltprocessor.c?r1=1.52&r2=1.53&diff_format=u
Index: php-src/ext/xsl/xsltprocessor.c
diff -u php-src/ext/xsl/xsltprocessor.c:1.52 
php-src/ext/xsl/xsltprocessor.c:1.53
--- php-src/ext/xsl/xsltprocessor.c:1.52        Sun Oct  8 13:34:24 2006
+++ php-src/ext/xsl/xsltprocessor.c     Tue Dec  5 12:05:03 2006
@@ -17,7 +17,7 @@
    +----------------------------------------------------------------------+
 */
 
-/* $Id: xsltprocessor.c,v 1.52 2006/10/08 13:34:24 bjori Exp $ */
+/* $Id: xsltprocessor.c,v 1.53 2006/12/05 12:05:03 rrichards Exp $ */
 
 #ifdef HAVE_CONFIG_H
 #include "config.h"
@@ -385,13 +385,15 @@
        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;

-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to