From 91b1a3d4b97330d73199808aa3f413546a417c92 Mon Sep 17 00:00:00 2001 From: gggeek Date: Sat, 11 Nov 2017 21:50:58 +0000 Subject: [PATCH] Hopefully better error messages when the received response is invalid --- src/PhpXmlRpc.php | 16 ++++++++-------- src/Request.php | 8 ++++---- 2 files changed, 12 insertions(+), 12 deletions(-) diff --git a/src/PhpXmlRpc.php b/src/PhpXmlRpc.php index ed49ac8..c17dcd8 100644 --- a/src/PhpXmlRpc.php +++ b/src/PhpXmlRpc.php @@ -36,22 +36,22 @@ class PhpXmlRpc static public $xmlrpcstr = array( 'unknown_method' => 'Unknown method', - 'invalid_return' => 'Invalid return payload: enable debugging to examine incoming payload', + 'invalid_return' => 'Invalid response payload (you can use the setDebug method to allow analysis of the response)', 'incorrect_params' => 'Incorrect parameters passed to method', 'introspect_unknown' => "Can't introspect: method unknown", - 'http_error' => "Didn't receive 200 OK from remote server.", - 'no_data' => 'No data received from server.', - 'no_ssl' => 'No SSL support compiled in.', + 'http_error' => "Didn't receive 200 OK from remote server", + 'no_data' => 'No data received from server', + 'no_ssl' => 'No SSL support compiled in', 'curl_fail' => 'CURL error', 'invalid_request' => 'Invalid request payload', - 'no_curl' => 'No CURL support compiled in.', + 'no_curl' => 'No CURL support compiled in', 'server_error' => 'Internal server error', 'multicall_error' => 'Received from server invalid multicall response', 'multicall_notstruct' => 'system.multicall expected struct', - 'multicall_nomethod' => 'missing methodName', + 'multicall_nomethod' => 'Missing methodName', 'multicall_notstring' => 'methodName is not a string', - 'multicall_recursion' => 'recursive system.multicall forbidden', - 'multicall_noparams' => 'missing params', + 'multicall_recursion' => 'Recursive system.multicall forbidden', + 'multicall_noparams' => 'Missing params', 'multicall_notarray' => 'params is not an array', 'cannot_decompress' => 'Received from server compressed HTTP and cannot decompress', diff --git a/src/Request.php b/src/Request.php index 54dc6c0..9bd9029 100644 --- a/src/Request.php +++ b/src/Request.php @@ -298,7 +298,7 @@ class Request xml_get_current_line_number($parser), xml_get_current_column_number($parser)); } error_log($errStr); - $r = new Response(0, PhpXmlRpc::$xmlrpcerr['invalid_return'], PhpXmlRpc::$xmlrpcstr['invalid_return'] . ' (' . $errStr . ')'); + $r = new Response(0, PhpXmlRpc::$xmlrpcerr['invalid_return'], PhpXmlRpc::$xmlrpcstr['invalid_return'] . ' ' . $errStr); xml_parser_free($parser); if ($this->debug) { print $errStr; @@ -380,10 +380,10 @@ class Request /** * Enables/disables the echoing to screen of the xmlrpc responses received. * - * @param integer $in values 0, 1, 2 are supported + * @param integer $level values 0, 1, 2 are supported */ - public function setDebug($in) + public function setDebug($level) { - $this->debug = $in; + $this->debug = $level; } } -- 2.43.0