* fixed: DateTimeInterface is not present in php 5.4 (error introduced in ver. 4.8.1)
+* new: allow users of the library to get more fine-grained information about errors in parsing received responses by
+ overriding the integer value of `PhpXmlRpc::$xmlrpcerr['invalid_xml']`, `PhpXmlRpc::$xmlrpcerr['xml_not_compliant']`,
+ `PhpXmlRpc::$xmlrpcerr['xml_parsing_error']` and the equivalent `PhpXmlRpc::$xmlrpcstr` strings. Feature req. #101
+
* improved: CI tests now run on php versions 5.4, 5.5 besides all more recent ones
* improved: the test container for local testing now defaults to php 7.4 on ubuntu 20 focal
{
static public $xmlrpcerr = array(
'unknown_method' => 1,
+ /// @deprecated. left in for BC
'invalid_return' => 2,
'incorrect_params' => 3,
'introspect_unknown' => 4,
'multicall_noparams' => 13,
'multicall_notarray' => 14,
'no_http2' => 15,
+ // the following 3 are meant to give greater insight than 'invalid_return'. They use the same code for BC,
+ // but you can override their value in your own code
+ 'invalid_xml' => 2,
+ 'xml_not_compliant' => 2,
+ 'xml_parsing_error' => 2,
'cannot_decompress' => 103,
'decompress_fail' => 104,
static public $xmlrpcstr = array(
'unknown_method' => 'Unknown method',
+ /// @deprecated. left in for BC
'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",
'multicall_noparams' => 'Missing params',
'multicall_notarray' => 'params is not an array',
'no_http2' => 'No HTTP/2 support compiled in',
+ // the following 3 are meant to give greater insight than 'invalid_return'. They use the same string for BC,
+ // but you can override their value in your own code
+ 'invalid_xml' => 'Invalid response payload (you can use the setDebug method to allow analysis of the response)',
+ 'xml_not_compliant' => 'Invalid response payload (you can use the setDebug method to allow analysis of the response)',
+ 'xml_parsing_error' => 'Invalid response payload (you can use the setDebug method to allow analysis of the response)',
'cannot_decompress' => 'Received from server compressed HTTP and cannot decompress',
'decompress_fail' => 'Received from server invalid compressed HTTP',
// BC break: in the past for some cases we used the error message: 'XML error at line 1, check URL'
- $r = new Response(0, PhpXmlRpc::$xmlrpcerr['invalid_return'],
- PhpXmlRpc::$xmlrpcstr['invalid_return'] . ' ' . $xmlRpcParser->_xh['isf_reason'], '',
+ $r = new Response(0, PhpXmlRpc::$xmlrpcerr['invalid_xml'],
+ PhpXmlRpc::$xmlrpcstr['invalid_xml'] . ' ' . $xmlRpcParser->_xh['isf_reason'], '',
$this->httpResponse
);
}
// second error check: xml well formed but not xml-rpc compliant
elseif ($xmlRpcParser->_xh['isf'] == 2) {
- $r = new Response(0, PhpXmlRpc::$xmlrpcerr['invalid_return'],
- PhpXmlRpc::$xmlrpcstr['invalid_return'] . ' ' . $xmlRpcParser->_xh['isf_reason'], '',
+ $r = new Response(0, PhpXmlRpc::$xmlrpcerr['xml_not_compliant'],
+ PhpXmlRpc::$xmlrpcstr['xml_not_compliant'] . ' ' . $xmlRpcParser->_xh['isf_reason'], '',
$this->httpResponse
);
// third error check: parsing of the response has somehow gone boink.
/// @todo shall we omit this check, since we trust the parsing code?
elseif ($returnType == XMLParser::RETURN_XMLRPCVALS && !is_object($xmlRpcParser->_xh['value'])) {
- // something odd has happened
- // and it's time to generate a client side error
- // indicating something odd went on
- $r = new Response(0, PhpXmlRpc::$xmlrpcerr['invalid_return'], PhpXmlRpc::$xmlrpcstr['invalid_return'],
+ // something odd has happened and it's time to generate a client side error indicating something odd went on
+ $r = new Response(0, PhpXmlRpc::$xmlrpcerr['xml_parsing_error'], PhpXmlRpc::$xmlrpcstr['xml_parsing_error'],
'', $this->httpResponse
);
} else {