From 5f069ef95a8887271828c0ccc9fffa20e0fd947e Mon Sep 17 00:00:00 2001 From: Dries Buytaert Date: Fri, 18 Dec 2009 16:49:10 +0000 Subject: - Patch #297860 by sun: fixed XML-RPC error handling. --- includes/xmlrpc.inc | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) (limited to 'includes/xmlrpc.inc') diff --git a/includes/xmlrpc.inc b/includes/xmlrpc.inc index cdf3f227d..4abbc8fa7 100644 --- a/includes/xmlrpc.inc +++ b/includes/xmlrpc.inc @@ -342,7 +342,7 @@ EOD; } -function xmlrpc_error($code = NULL, $message = NULL) { +function xmlrpc_error($code = NULL, $message = NULL, $reset = FALSE) { static $xmlrpc_error; if (isset($code)) { $xmlrpc_error = new stdClass(); @@ -350,6 +350,9 @@ function xmlrpc_error($code = NULL, $message = NULL) { $xmlrpc_error->code = $code; $xmlrpc_error->message = $message; } + elseif ($reset) { + $xmlrpc_error = NULL; + } return $xmlrpc_error; } @@ -441,6 +444,7 @@ function xmlrpc_base64_get_xml($xmlrpc_base64) { function _xmlrpc() { $args = func_get_args(); $url = array_shift($args); + xmlrpc_clear_error(); if (is_array($args[0])) { $method = 'system.multicall'; $multicall_args = array(); @@ -494,3 +498,10 @@ function xmlrpc_error_msg() { $error = xmlrpc_error(); return ($error != NULL ? $error->message : NULL); } + +/** + * Clears any previous error. + */ +function xmlrpc_clear_error() { + xmlrpc_error(NULL, NULL, TRUE); +} -- cgit v1.2.3