# call_user_function/wddx_serialize_vars Question

- Thread: https://externals.io/message/2469
- Original archive: https://news-web.php.net/php.internals/2469
- Started by Jeraimee Hughes on 2003-06-20T18:57:39+00:00
- Messages: 2
- Reply by email to internals@lists.php.net
- More for agents: search with https://externals.io/search.md?q={query} · RFCs at https://externals.io/rfc.md · JSON API at https://externals.io/api · documentation at https://externals.io/llms.txt

---

## #2469 — Jeraimee Hughes — 2003-06-20T18:57:39+00:00

URL: https://externals.io/message/2469#2469

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, &params, &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, &params_wddx, 1, &params_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

---

## #2609 — Andrei Zmievski — 2003-06-23T14:20:07+00:00

URL: https://externals.io/message/2469#2609 · In reply to: #2469

> 	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, &params_wddx, 1, &params_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
