summaryrefslogtreecommitdiff
path: root/ext/xsl/php_xsl.c
diff options
context:
space:
mode:
authorRob Richards <rrichards@php.net>2003-12-09 20:12:39 +0000
committerRob Richards <rrichards@php.net>2003-12-09 20:12:39 +0000
commit49494dee00570104f34966e375462c08b4489a39 (patch)
tree4eebd7186475a2e7893090af1776e8325b144000 /ext/xsl/php_xsl.c
parentf02936c683d859dfd82e0ecb5d66fe34ac9d0633 (diff)
downloadphp-git-49494dee00570104f34966e375462c08b4489a39.tar.gz
fix issues when passing in mulitple arguments
Diffstat (limited to 'ext/xsl/php_xsl.c')
-rw-r--r--ext/xsl/php_xsl.c12
1 files changed, 8 insertions, 4 deletions
diff --git a/ext/xsl/php_xsl.c b/ext/xsl/php_xsl.c
index 113c2568f0..917bfb2d57 100644
--- a/ext/xsl/php_xsl.c
+++ b/ext/xsl/php_xsl.c
@@ -176,8 +176,12 @@ static void xsl_ext_function_php(xmlXPathParserContextPtr ctxt, int nargs, int t
return;
}
- args = safe_emalloc(sizeof(zval **), nargs - 1, 0);
- for (i = 0; i < nargs - 1; i++) {
+ fci.param_count = nargs - 1;
+ fci.params = safe_emalloc(fci.param_count, sizeof(zval**), 0);
+
+ args = safe_emalloc(nargs - 1, sizeof(zval *), 0);
+ /* Reverse order to pop values off ctxt stack */
+ for (i = nargs - 2; i >= 0; i--) {
obj = valuePop(ctxt);
MAKE_STD_ZVAL(args[i]);
switch (obj->type) {
@@ -236,6 +240,7 @@ static void xsl_ext_function_php(xmlXPathParserContextPtr ctxt, int nargs, int t
ZVAL_STRING(args[i], "", 0);
}
xmlXPathFreeObject(obj);
+ fci.params[i] = &args[i];
}
fci.size = sizeof(fci);
@@ -250,8 +255,6 @@ static void xsl_ext_function_php(xmlXPathParserContextPtr ctxt, int nargs, int t
fci.symbol_table = NULL;
fci.object_pp = NULL;
fci.retval_ptr_ptr = &retval;
- fci.param_count = nargs - 1;
- fci.params = &args;
fci.no_separation = 0;
/*fci.function_handler_cache = &function_ptr;*/
@@ -280,6 +283,7 @@ static void xsl_ext_function_php(xmlXPathParserContextPtr ctxt, int nargs, int t
zval_ptr_dtor(&args[i]);
}
efree(args);
+ efree(fci.params);
}
static void xsl_ext_function_string_php(xmlXPathParserContextPtr ctxt, int nargs)