Commit 37bacdac authored by Dries's avatar Dries
Browse files

- Patch #646678 by fgm: fixed incorrect multicall implementation.

parent 43089856
...@@ -433,13 +433,15 @@ function xmlrpc_base64_get_xml($xmlrpc_base64) { ...@@ -433,13 +433,15 @@ function xmlrpc_base64_get_xml($xmlrpc_base64) {
* An array of call arrays. Each call array follows the pattern of the single * An array of call arrays. Each call array follows the pattern of the single
* request: method name followed by the arguments to the method. * request: method name followed by the arguments to the method.
* @return * @return
* For one request: * Either the return value of the method on success, or FALSE. If FALSE is
* Either the return value of the method on success, or FALSE. * returned, see xmlrpc_errno() and xmlrpc_error_msg().
* If FALSE is returned, see xmlrpc_errno() and xmlrpc_error_msg(). * - For a non-multicall request: the result just as if this had been a local
* For multiple requests: * function call.
* An array of results. Each result will either be the result * - For a multicall request: an array of results. Each result will either be
* returned by the method called, or an xmlrpc_error object if the call * a one-element array containing the result returned by the method called,
* failed. See xmlrpc_error(). * or an xmlrpc_error object if the call failed.
*
* @see xmlrpc_error()
*/ */
function _xmlrpc() { function _xmlrpc() {
$args = func_get_args(); $args = func_get_args();
...@@ -479,8 +481,23 @@ function _xmlrpc() { ...@@ -479,8 +481,23 @@ function _xmlrpc() {
xmlrpc_error($message->fault_code, $message->fault_string); xmlrpc_error($message->fault_code, $message->fault_string);
return FALSE; return FALSE;
} }
// Message must be OK // We now know that the message is well-formed and a non-fault result.
return $message->params[0]; if ($method == 'system.multicall') {
// Return per-method results or error objects.
$return = array();
foreach ($message->params[0] as $result) {
if (array_keys($result) == array(0)) {
$return[] = $result[0];
}
else {
$return[] = xmlrpc_error($result['faultCode'], $result['faultString']);
}
}
}
else {
$return = $message->params[0];
}
return $return;
} }
/** /**
......
...@@ -235,7 +235,7 @@ function xmlrpc_server_multicall($methodcalls) { ...@@ -235,7 +235,7 @@ function xmlrpc_server_multicall($methodcalls) {
); );
} }
else { else {
$return[] = $result; $return[] = array($result);
} }
} }
return $return; return $return;
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment