if (is_array($req)) {
// $req is an array of Requests
+ /// @todo switch to the new syntax for multicall
return $this->multicall($req, $timeout, $method);
} elseif (is_string($req)) {
$n = new static::$requestClass('');
* Unfortunately, there is no server error code universally used to denote the fact that multicall is unsupported,
* so there is no way to reliably distinguish between that and a temporary failure.
* If you are sure that server supports multicall and do not want to fallback to using many single calls, set the
- * fourth parameter to FALSE.
+ * 2np parameter to FALSE.
*
* NB: trying to shoehorn extra functionality into existing syntax has resulted
* in pretty much convoluted code...
*
* @param Request[] $reqs an array of Request objects
- * @param integer $timeout deprecated - connection timeout (in seconds). See the details in the docs for the send() method
- * @param string $method deprecated - the http protocol variant to be used. See the details in the docs for the send() method
- * @param boolean $fallback When true, upon receiving an error during multicall, multiple single calls will be
- * attempted
+ * @param bool $noFallback When true, upon receiving an error during multicall, multiple single calls will not be
+ * attempted.
+ * Deprecated alternative, was: int - "connection timeout (in seconds). See the details in the
+ * docs for the send() method". Please use setOption instead to set a timeout
+ * @param string $method deprecated. Was: "the http protocol variant to be used. See the details in the docs for the send() method."
+ * Please use the constructor to set an http protocol variant.
+ * @param boolean $fallback deprecated. Was: "w"hen true, upon receiving an error during multicall, multiple single
+ * calls will be attempted"
* @return Response[]
*/
public function multicall($reqs, $timeout = 0, $method = '', $fallback = true)
{
+ // BC
+ if (is_bool($timeout) && $fallback === true) {
+ $fallback = !$timeout;
+ $timeout = 0;
+ }
+
if ($method == '') {
$method = $this->method;
}
// Save what we received, before parsing it
if ($this->debug > 1) {
- $this->debugmsg("+++GOT+++\n" . $data . "\n+++END+++");
+ $this->debugMsg("+++GOT+++\n" . $data . "\n+++END+++");
}
$resp = $this->parseRequestHeaders($data, $reqCharset, $respCharset, $respEncoding);
}
if ($this->debug > 2 && static::$_xmlrpcs_occurred_errors != '') {
- $this->debugmsg("+++PROCESSING ERRORS AND WARNINGS+++\n" .
+ $this->debugMsg("+++PROCESSING ERRORS AND WARNINGS+++\n" .
static::$_xmlrpcs_occurred_errors . "+++END+++");
}
*
* @todo raise a warning if the user tries to register a 'system.' method
*/
+ public function addToMap($methodName, $function, $sig = null, $doc = false, $sigDoc = false, $parametersType = false,
+ $exceptionHandling = false)
+ {
+ return $this->addToMap($methodName, $function, $sig, $doc, $sigDoc, $parametersType, $exceptionHandling);
+ }
+
+ /**
+ * Add a method to the dispatch map.
+ *
+ * @param string $methodName the name with which the method will be made available
+ * @param callable $function the php function that will get invoked
+ * @param array[] $sig the array of valid method signatures.
+ * Each element is one signature: an array of strings with at least one element
+ * First element = type of returned value. Elements 2..N = types of parameters 1..N
+ * @param string $doc method documentation
+ * @param array[] $sigDoc the array of valid method signatures docs, following the format of $sig but with
+ * descriptions instead of types (one string for return type, one per param)
+ * @param string $parametersType to allow single method handlers to receive php values instead of a Request, or vice-versa
+ * @param int $exceptionHandling @see $this->exception_handling
+ * @return void
+ *
+ * @todo raise a warning if the user tries to register a 'system.' method
+ * @deprecated use addToMap instead
+ */
public function add_to_map($methodName, $function, $sig = null, $doc = false, $sigDoc = false, $parametersType = false,
$exceptionHandling = false)
{
+ $this->logDeprecationUnlessCalledBy('addToMap');
+
$this->dmap[$methodName] = array(
'function' => $function,
'docstring' => $doc,
if ($this->debug > 1) {
if (function_exists('getallheaders')) {
- $this->debugmsg(''); // empty line
+ $this->debugMsg(''); // empty line
foreach (getallheaders() as $name => $val) {
- $this->debugmsg("HEADER: $name: $val");
+ $this->debugMsg("HEADER: $name: $val");
}
}
}
if ($contentEncoding == 'deflate' && $degzdata = @gzuncompress($data)) {
$data = $degzdata;
if ($this->debug > 1) {
- $this->debugmsg("\n+++INFLATED REQUEST+++[" . strlen($data) . " chars]+++\n" . $data . "\n+++END+++");
+ $this->debugMsg("\n+++INFLATED REQUEST+++[" . strlen($data) . " chars]+++\n" . $data . "\n+++END+++");
}
} elseif ($contentEncoding == 'gzip' && $degzdata = @gzinflate(substr($data, 10))) {
$data = $degzdata;
if ($this->debug > 1) {
- $this->debugmsg("+++INFLATED REQUEST+++[" . strlen($data) . " chars]+++\n" . $data . "\n+++END+++");
+ $this->debugMsg("+++INFLATED REQUEST+++[" . strlen($data) . " chars]+++\n" . $data . "\n+++END+++");
}
} else {
$r = new Response(0, PhpXmlRpc::$xmlrpcerr['server_decompress_fail'],
)
) {
if ($this->debug > 1) {
- $this->debugmsg("\n+++PARSED+++\n" . var_export($_xh['params'], true) . "\n+++END+++");
+ $this->debugMsg("\n+++PARSED+++\n" . var_export($_xh['params'], true) . "\n+++END+++");
}
return $this->execute($_xh['method'], $_xh['params'], $_xh['pt']);
}
if ($this->debug > 1) {
- $this->debugmsg("\n+++PARSED+++\n" . var_export($req, true) . "\n+++END+++");
+ $this->debugMsg("\n+++PARSED+++\n" . var_export($req, true) . "\n+++END+++");
}
return $this->execute($req);
* @param string $string
* @return void
*/
- protected function debugmsg($string)
+ protected function debugMsg($string)
{
$this->debug_info .= $string . "\n";
}