From: Christian Stocker Date: Wed, 10 Dec 2003 22:32:36 +0000 (+0000) Subject: fix crashes when you call php:functionString() with a X-Git-Tag: php-5.0.0b3RC1~139 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=87bd1f4d0283ef35f3cd1316ee66750598f05bd2;p=php fix crashes when you call php:functionString() with a non-string handler (by adam) --- diff --git a/ext/xsl/php_xsl.c b/ext/xsl/php_xsl.c index 917bfb2d57..a58d90730d 100644 --- a/ext/xsl/php_xsl.c +++ b/ext/xsl/php_xsl.c @@ -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);