diff options
author | Dries Buytaert <dries@buytaert.net> | 2009-12-29 19:33:36 +0000 |
---|---|---|
committer | Dries Buytaert <dries@buytaert.net> | 2009-12-29 19:33:36 +0000 |
commit | 37bacdacfb2e45d86ad0a1c6791b6ed540ff83fe (patch) | |
tree | 4cab60169b5df23b24715c706261bd33543b1a94 /includes/xmlrpc.inc | |
parent | 43089856c7119fd5d2d3fc5ff410f307a0546472 (diff) | |
download | brdo-37bacdacfb2e45d86ad0a1c6791b6ed540ff83fe.tar.gz brdo-37bacdacfb2e45d86ad0a1c6791b6ed540ff83fe.tar.bz2 |
- Patch #646678 by fgm: fixed incorrect multicall implementation.
Diffstat (limited to 'includes/xmlrpc.inc')
-rw-r--r-- | includes/xmlrpc.inc | 35 |
1 files changed, 26 insertions, 9 deletions
diff --git a/includes/xmlrpc.inc b/includes/xmlrpc.inc index 4abbc8fa7..688605bf2 100644 --- a/includes/xmlrpc.inc +++ b/includes/xmlrpc.inc @@ -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 * request: method name followed by the arguments to the method. * @return - * For one request: - * Either the return value of the method on success, or FALSE. - * If FALSE is returned, see xmlrpc_errno() and xmlrpc_error_msg(). - * For multiple requests: - * An array of results. Each result will either be the result - * returned by the method called, or an xmlrpc_error object if the call - * failed. See xmlrpc_error(). + * Either the return value of the method on success, or FALSE. 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 + * function call. + * - For a multicall request: an array of results. Each result will either be + * a one-element array containing the result returned by the method called, + * or an xmlrpc_error object if the call failed. + * + * @see xmlrpc_error() */ function _xmlrpc() { $args = func_get_args(); @@ -479,8 +481,23 @@ function _xmlrpc() { xmlrpc_error($message->fault_code, $message->fault_string); return FALSE; } - // Message must be OK - return $message->params[0]; + // We now know that the message is well-formed and a non-fault result. + 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; } /** |