RPC - sending some scripts and more params.
Reported by Vojtech Jina | January 28th, 2009 @ 06:44 AM
I have problem with ajax requests... I need to send back, as a response, some JS and then eval it or not, thats not important... When I use RPC (saf/Misc/RPC.php) everything goes through rpc_serialize() and thats the problem... Serializing objects, arrays, numbers, strings.... everything work fine... But sometimes I need to send the raw code... I managed it by adding parameter to rpc_handle() whether I want to serialize the data or not... Do you thing its a good sollution ? Maybe its possible to make without code changing, but I dont know how... If somebody wants it, I can upload it...
Second thing, is sending more than one parameter... It sends only the first one. The problem is in rpc_handle()
// remove unwanted parameters
unset ($parameters['mode']);
unset ($parameters['page']);
unset ($parameters['error']);
unset ($parameters['files']);
unset ($parameters['param']);
unset ($parameters['method']);
unset ($parameters['_rewrite_sticky']);
if ($_SERVER['REQUEST_METHOD'] == 'GET') {
$res = call_user_func_array (
array (&$obj, $method),
$parameters
);
}
At this time, array parameters contains all params, that we have sent... But in specific $obj->$method() call, there is only the first one.... I DONT KNOW WHY ?
This works fine...
if ($_SERVER['REQUEST_METHOD'] == 'GET') {
$res = call_user_func_array (
array (&$obj, $method),
array('param' => $parameters)
);
}
But we have to know it, when making some applications... Now, all params are send to the function call as one array.
No comments found
Please Sign in or create a free account to add a new ticket.
With your very own profile, you can contribute to projects, track your activity, watch tickets, receive and update tickets through your email and much more.
Create your profile
Help contribute to this project by taking a few moments to create your personal profile. Create your profile ยป
The Sitellite web content management system.