]> granicus.if.org Git - php/commitdiff
fix crashes when you call php:functionString() with a
authorChristian Stocker <chregu@php.net>
Wed, 10 Dec 2003 22:32:36 +0000 (22:32 +0000)
committerChristian Stocker <chregu@php.net>
Wed, 10 Dec 2003 22:32:36 +0000 (22:32 +0000)
non-string handler (by adam)

ext/xsl/php_xsl.c

index 917bfb2d57cd643cbf69d9dd063dbfedc302ceb5..a58d90730d0a339c68b230ed70be328cf22839c7 100644 (file)
@@ -247,6 +247,16 @@ static void xsl_ext_function_php(xmlXPathParserContextPtr ctxt, int nargs, int t
        fci.function_table = EG(function_table);
        
        obj = valuePop(ctxt);
+       if (obj->stringval == NULL) {
+               php_error_docref(NULL TSRMLS_CC, E_WARNING, "Handler name must be a string");
+               xmlXPathFreeObject(obj);
+               for (i = 0; i < nargs - 1; i++) {
+                       zval_ptr_dtor(&args[i]);
+               }
+               efree(args);
+               efree(fci.params);
+               return; 
+       }
        INIT_PZVAL(&handler);
        ZVAL_STRING(&handler, obj->stringval, 1);
        xmlXPathFreeObject(obj);