rrichards               Tue Dec  5 12:04:34 2006 UTC

  Modified files:              (Branch: PHP_5_2)
    /php-src/ext/xsl    xsltprocessor.c 
  Log:
  fix bug #39625 (Apache crashes on importStylesheet call)
  
http://cvs.php.net/viewvc.cgi/php-src/ext/xsl/xsltprocessor.c?r1=1.39.2.2.2.4&r2=1.39.2.2.2.5&diff_format=u
Index: php-src/ext/xsl/xsltprocessor.c
diff -u php-src/ext/xsl/xsltprocessor.c:1.39.2.2.2.4 
php-src/ext/xsl/xsltprocessor.c:1.39.2.2.2.5
--- php-src/ext/xsl/xsltprocessor.c:1.39.2.2.2.4        Mon Jul 31 13:05:35 2006
+++ php-src/ext/xsl/xsltprocessor.c     Tue Dec  5 12:04:34 2006
@@ -17,7 +17,7 @@
    +----------------------------------------------------------------------+
 */
 
-/* $Id: xsltprocessor.c,v 1.39.2.2.2.4 2006/07/31 13:05:35 chregu Exp $ */
+/* $Id: xsltprocessor.c,v 1.39.2.2.2.5 2006/12/05 12:04:34 rrichards Exp $ */
 
 #ifdef HAVE_CONFIG_H
 #include "config.h"
@@ -384,13 +384,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