*/
protected $dmap = array();
/**
- * Defines how functions in dmap will be invoked: either using an xmlrpc msg object
+ * Defines how functions in dmap will be invoked: either using an xmlrpc request object
* or plain php values.
- * valid strings are 'xmlrpcvals', 'phpvals' or 'epivals'
+ * Valid strings are 'xmlrpcvals', 'phpvals' or 'epivals'
*/
public $functions_parameters_type = 'xmlrpcvals';
/**
* Option used for fine-tuning the encoding the php values returned from
* functions registered in the dispatch map when the functions_parameters_types
* member is set to 'phpvals'
- * @see php_xmlrpc_encode for a list of values
+ * @see Encoder::encode for a list of values
*/
public $phpvals_encoding_options = array('auto_dates');
/**
*/
public $debug = 1;
/**
- * Controls behaviour of server when invoked user function throws an exception:
+ * Controls behaviour of server when the invoked user function throws an exception:
* 0 = catch it and return an 'internal error' xmlrpc response (default)
* 1 = catch it and return an xmlrpc response with the error corresponding to the exception
* 2 = allow the exception to float to the upper layers
/**
* When set to true, it will enable HTTP compression of the response, in case
* the client has declared its support for compression in the request.
+ * Set at constructor time.
*/
public $compress_response = false;
/**
- * List of http compression methods accepted by the server for requests.
+ * List of http compression methods accepted by the server for requests. Set at constructor time.
* NB: PHP supports deflate, gzip compressions out of the box if compiled w. zlib
*/
public $accepted_compression = array();
/// shall we serve calls to system.* methods?
public $allow_system_funcs = true;
- /// list of charset encodings natively accepted for requests
+ /**
+ * List of charset encodings natively accepted for requests.
+ * Set at constructor time.
+ */
public $accepted_charset_encodings = array();
/**
* charset encoding to be used for response.
/**
* @param array $dispatchMap the dispatch map with definition of exposed services
- * @param boolean $servicenow set to false to prevent the server from running upon construction
+ * @param boolean $serviceNow set to false to prevent the server from running upon construction
*/
public function __construct($dispatchMap = null, $serviceNow = true)
{
// by default the xml parser can support these 3 charset encodings
$this->accepted_charset_encodings = array('UTF-8', 'ISO-8859-1', 'US-ASCII');
- // dispMap is a dispatch array of methods
- // mapped to function names and signatures
- // if a method
- // doesn't appear in the map then an unknown
- // method error is generated
+ // dispMap is a dispatch array of methods mapped to function names and signatures.
+ // If a method doesn't appear in the map then an unknown method error is generated
/* milosch - changed to make passing dispMap optional.
- * instead, you can use the class add_to_map() function
- * to add functions manually (borrowed from SOAPX4)
- */
+ * instead, you can use the class add_to_map() function
+ * to add functions manually (borrowed from SOAPX4)
+ */
if ($dispatchMap) {
$this->dmap = $dispatchMap;
if ($serviceNow) {
/**
* Verify type and number of parameters received against a list of known signatures.
*
- * @param array $in array of either xmlrpc value objects or xmlrpc type definitions
- * @param array $sig array of known signatures to match against
+ * @param array|Request $in array of either xmlrpc value objects or xmlrpc type definitions
+ * @param array $sigs array of known signatures to match against
*
* @return array
*/
- protected function verifySignature($in, $sig)
+ protected function verifySignature($in, $sigs)
{
// check each possible signature in turn
if (is_object($in)) {
} else {
$numParams = count($in);
}
- foreach ($sig as $cursig) {
- if (count($cursig) == $numParams + 1) {
+ foreach ($sigs as $curSig) {
+ if (count($curSig) == $numParams + 1) {
$itsOK = 1;
for ($n = 0; $n < $numParams; $n++) {
if (is_object($in)) {
}
// param index is $n+1, as first member of sig is return type
- if ($pt != $cursig[$n + 1] && $cursig[$n + 1] != Value::$xmlrpcValue) {
+ if ($pt != $curSig[$n + 1] && $curSig[$n + 1] != Value::$xmlrpcValue) {
$itsOK = 0;
$pno = $n + 1;
- $wanted = $cursig[$n + 1];
+ $wanted = $curSig[$n + 1];
$got = $pt;
break;
}
if (isset($dmap[$methName]['signature'])) {
$sigs = array();
foreach ($dmap[$methName]['signature'] as $inSig) {
- $cursig = array();
+ $curSig = array();
foreach ($inSig as $sig) {
- $cursig[] = new Value($sig, 'string');
+ $curSig[] = new Value($sig, 'string');
}
- $sigs[] = new Value($cursig, 'array');
+ $sigs[] = new Value($curSig, 'array');
}
$r = new Response(new Value($sigs, 'array'));
} else {
}
$numParams = $params->arraysize();
- $msg = new Request($methName->scalarval());
+ $req = new Request($methName->scalarval());
for ($i = 0; $i < $numParams; $i++) {
- if (!$msg->addParam($params->arraymem($i))) {
+ if (!$req->addParam($params->arraymem($i))) {
$i++;
return static::_xmlrpcs_multicall_error(new Response(0,
}
}
- $result = $server->execute($msg);
+ $result = $server->execute($req);
if ($result->faultCode() != 0) {
return static::_xmlrpcs_multicall_error($result); // Method returned fault.