* improved: removed usage of `extension_loaded` in favour of `function_exists` when checking for mbstring. This allows
for mbstring functions to be polyfilled
+* improved: the code generated by `Wrapper::buildWrapMethodSource` is formatter slightly better
+
+* improved: made the `Wrapper` and `Client` classes easy to subclass for use by the PhpJsonRpc library
+
* improved: added the library version number to the debugger title line
+* improved: the debugger will now sport the "load method synopsis" button when interacting with json-rpc servers
+
* improved: made sure the test container has at least one locale with comma as decimal separator
* BC notes:
- if you had been somehow interacting with private method `Client::_try_multicall`, be warned its returned data has
changed: it now returns a Response for the cases in which it previously returned false, and an array of Response
objects for the cases in which it previously returned a string
+ - if you subclassed the `Client` class, take care of new static variables `$requestClass` and `$responseClass`
## XML-RPC for PHP version 4.9.5 - 2023/01/11
const USE_CURL_AUTO = 2;
protected static $logger;
+ /** @var string */
+ protected static $requestClass = '\\PhpXmlRpc\\Request';
+ /** @var string */
+ protected static $responseClass = '\\PhpXmlRpc\\Response';
/// @todo: do these need to be public?
public $method = 'http';
return $r;
} elseif (is_string($req)) {
- $n = new Request('');
+ $n = new static::$requestClass('');
$n->payload = $req;
$req = $n;
}
}
$this->errstr = 'Connect error: ' . $this->errstr;
- $r = new Response(0, PhpXmlRpc::$xmlrpcerr['http_error'], $this->errstr . ' (' . $this->errno . ')');
+ $r = new static::$responseClass(0, PhpXmlRpc::$xmlrpcerr['http_error'], $this->errstr . ' (' . $this->errno . ')');
return $r;
}
if (!fputs($fp, $op, strlen($op))) {
fclose($fp);
$this->errstr = 'Write error';
- $r = new Response(0, PhpXmlRpc::$xmlrpcerr['http_error'], $this->errstr);
+ $r = new static::$responseClass(0, PhpXmlRpc::$xmlrpcerr['http_error'], $this->errstr);
return $r;
}
{
if (!function_exists('curl_init')) {
$this->errstr = 'CURL unavailable on this install';
- return new Response(0, PhpXmlRpc::$xmlrpcerr['no_curl'], PhpXmlRpc::$xmlrpcstr['no_curl']);
+ return new static::$responseClass(0, PhpXmlRpc::$xmlrpcerr['no_curl'], PhpXmlRpc::$xmlrpcstr['no_curl']);
}
if ($method == 'https' || $method == 'h2') {
// q: what about installs where we get back a string, but curl is linked to other ssl libs than openssl?
((is_string($info) && strpos($info, 'OpenSSL') === null) || (is_array($info) && !isset($info['ssl_version'])))
) {
$this->errstr = 'SSL unavailable on this install';
- return new Response(0, PhpXmlRpc::$xmlrpcerr['no_ssl'], PhpXmlRpc::$xmlrpcstr['no_ssl']);
+ return new static::$responseClass(0, PhpXmlRpc::$xmlrpcerr['no_ssl'], PhpXmlRpc::$xmlrpcstr['no_ssl']);
}
}
if (($method == 'h2' && !defined('CURL_HTTP_VERSION_2_0')) ||
($method == 'h2c' && !defined('CURL_HTTP_VERSION_2_PRIOR_KNOWLEDGE'))) {
$this->errstr = 'HTTP/2 unavailable on this install';
- return new Response(0, PhpXmlRpc::$xmlrpcerr['no_http2'], PhpXmlRpc::$xmlrpcstr['no_http2']);
+ return new static::$responseClass(0, PhpXmlRpc::$xmlrpcerr['no_http2'], PhpXmlRpc::$xmlrpcstr['no_http2']);
}
$curl = $this->prepareCurlHandle($req, $server, $port, $timeout, $username, $password,
$keyPass, $sslVersion);
if (!$curl) {
- return new Response(0, PhpXmlRpc::$xmlrpcerr['curl_fail'], PhpXmlRpc::$xmlrpcstr['curl_fail'] . ': error during curl initialization. Check php error log for details');
+ return new static::$responseClass(0, PhpXmlRpc::$xmlrpcerr['curl_fail'], PhpXmlRpc::$xmlrpcstr['curl_fail'] . ': error during curl initialization. Check php error log for details');
}
$result = curl_exec($curl);
/// @todo we should use a better check here - what if we get back '' or '0'?
$this->errstr = 'no response';
- $resp = new Response(0, PhpXmlRpc::$xmlrpcerr['curl_fail'], PhpXmlRpc::$xmlrpcstr['curl_fail'] . ': ' . curl_error($curl));
+ $resp = new static::$responseClass(0, PhpXmlRpc::$xmlrpcerr['curl_fail'], PhpXmlRpc::$xmlrpcstr['curl_fail'] . ': ' . curl_error($curl));
curl_close($curl);
if ($keepAlive) {
$this->xmlrpc_curl_handle = null;