I'm using the code below to use call_user_function to attempt to make a wddx packet.
What I'm getting is the following wddx packet:
<wddxPacket version='1.0'><header/><data><struct></struct></data></wddxPacket>
Obviously I'm passing something incorrectly to call_user_function, but since this
is my first time using call_user_function I'm not sure what.
Note that I've tested the params array against IS_ARRAY and it passes.
zend_print_pval_r() also shows the right data within the array.
Any pointers on what I've screwed up here?
-----------------8<-----------------------------
/* Excuse the debugging and extra code */
char *spname = NULL;
char *dbname = NULL;
char *func_name = "wddx_serialize_vars";
int argc = ZEND_NUM_ARGS();
int spname_len;
int dbname_len;
int i;
int cnt;
zval *params;
zval *function_name;
zval *params_wddx = NULL;
zval *params_array;
MAKE_STD_ZVAL(function_name);
ZVAL_STRING(function_name, func_name, 1);
MAKE_STD_ZVAL(params_array);
array_init(params_array);
if (zend_parse_parameters(argc TSRMLS_CC, "sas", &spname, &spname_len, ¶ms, &dbname, &dbname_len) == FAILURE) {
return;
}
if (Z_TYPE_P(params) == IS_ARRAY) {
zend_printf("\n%s\n", "params is an array");
}
else {
zend_printf("\n%s\n", "params is not an array");
}
add_index_zval(params_array, 0, params);
if (FAILURE == call_user_function(CG(function_table), NULL, function_name, ¶ms_wddx, 1, ¶ms_array TSRMLS_CC)) {
zend_printf("%s\n", *function_name);
zend_error(E_ERROR, "Function call failed");
}
zend_printf("\n%s\n", params_wddx);
----------------->8-----------------------------
Jeraimee
zval *params;
zval *function_name;
zval *params_wddx = NULL;
zval *params_array;
[snipped]
add_index_zval(params_array, 0, params);
if (FAILURE == call_user_function(CG(function_table), NULL, function_name, ¶ms_wddx, 1, ¶ms_array TSRMLS_CC)) {
zend_printf("%s\n", *function_name);
zend_error(E_ERROR, "Function call failed");
}
params_array is supposed to be an array of pointers to zval**.
-Andrei
"Then again, E=mc^2 may only be a local phenomenon."
-- Einstein