|
| __construct ($dispatchMap=null, $serviceNow=true) |
|
& | __get ($name) |
|
| __isset ($name) |
|
| __set ($name, $value) |
|
| __unset ($name) |
|
| add_to_map ($methodName, $function, $sig=null, $doc=false, $sigDoc=false, $parametersType=false, $exceptionHandling=false) |
| Add a method to the dispatch map.
|
|
| addToMap ($methodName, $function, $sig=null, $doc=false, $sigDoc=false, $parametersType=false, $exceptionHandling=false) |
| Add a method to the dispatch map.
|
|
| getCapabilities () |
|
| getDispatchMap () |
|
| getOption ($name) |
|
| getOptions () |
| Returns the complete list of Server options.
|
|
| getSystemDispatchMap () |
|
| methodNameCallback ($methodName, $xmlParser, $parser) |
| Registered as callback for when the XMLParser has found the name of the method to execute.
|
|
| parseRequest ($data, $reqEncoding='') |
| Parse an xml chunk containing an xml-rpc request and execute the corresponding php function registered with the server.
|
|
| serializeDebug ($charsetEncoding='') |
| Return a string with the serialized representation of all debug info.
|
|
| service ($data=null, $returnPayload=false) |
| Execute the xml-rpc request, printing the response.
|
|
| setDebug ($level) |
| Set debug level of server.
|
|
| setDispatchMap ($dmap) |
|
| setOption ($name, $value) |
|
| setOptions ($options) |
|
|
static | _xmlrpcs_errorHandler ($errCode, $errString, $filename=null, $lineNo=null, $context=null) |
| Error handler used to track errors that occur during server-side execution of PHP code.
|
|
static | _xmlrpcs_getCapabilities ($server, $req=null) |
|
static | _xmlrpcs_listMethods ($server, $req=null) |
|
static | _xmlrpcs_methodHelp ($server, $req) |
|
static | _xmlrpcs_methodSignature ($server, $req) |
|
static | _xmlrpcs_multicall ($server, $req) |
|
static | _xmlrpcs_multicall_do_call ($server, $call) |
|
static | _xmlrpcs_multicall_do_call_phpvals ($server, $call) |
|
static | _xmlrpcs_multicall_error ($err) |
|
static | error_occurred ($msg) |
| Add a string to the debug info that will be later serialized by the server as part of the response message (base64 encoded) when debug level >= 2.
|
|
static | xmlrpc_debugmsg ($msg) |
| Add a string to the debug info that can be later serialized by the server as part of the response message.
|
|
|
mixed | $user_data = null |
| Extra data passed at runtime to method handling functions.
|
|
const | OPT_ACCEPTED_COMPRESSION = 'accepted_compression' |
|
const | OPT_ALLOW_SYSTEM_FUNCS = 'allow_system_funcs' |
|
const | OPT_COMPRESS_RESPONSE = 'compress_response' |
|
const | OPT_DEBUG = 'debug' |
|
const | OPT_EXCEPTION_HANDLING = 'exception_handling' |
|
const | OPT_FUNCTIONS_PARAMETERS_TYPE = 'functions_parameters_type' |
|
const | OPT_PHPVALS_ENCODING_OPTIONS = 'phpvals_encoding_options' |
|
const | OPT_RESPONSE_CHARSET_ENCODING = 'response_charset_encoding' |
|
|
| debugMsg ($string) |
| Add a string to the 'internal debug message' (separate from 'user debug message').
|
|
| execute ($req, $params=null, $paramTypes=null) |
| Execute a method invoked by the client, checking parameters used.
|
|
| isSyscall ($methName) |
|
| parseRequestHeaders (&$data, &$reqEncoding, &$respEncoding, &$respCompression) |
| Parse http headers received along with xml-rpc request.
|
|
| verifySignature ($in, $sigs) |
| Verify type and number of parameters received against a list of known signatures.
|
|
| xml_header ($charsetEncoding='') |
|
|
string[] | $accepted_compression = array() |
| List of http compression methods accepted by the server for requests.
|
|
bool | $allow_system_funcs = true |
| Shall we serve calls to system.
|
|
bool | $compress_response = false |
| 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.
|
|
int | $debug = 1 |
| Controls whether the server is going to echo debugging messages back to the client as comments in response body.
|
|
| $debug_info = '' |
| Storage for internal debug info.
|
|
array[] | $dmap = array() |
| Array defining php functions exposed as xml-rpc methods by this server.
|
|
int | $exception_handling = 0 |
| Controls behaviour of server when the invoked method-handler function throws an exception (within the execute method): 0 = catch it and return an 'internal error' xml-rpc response (default) 1 = SECURITY SENSITIVE DO NOT ENABLE ON PUBLIC SERVERS!!! catch it and return an xml-rpc response with the error corresponding to the exception, both its code and message.
|
|
string | $functions_parameters_type = 'xmlrpcvals' |
| Defines how functions in $dmap will be invoked: either using an xml-rpc Request object or plain php values.
|
|
array | $phpvals_encoding_options = array('auto_dates') |
| Option used for fine-tuning the encoding the php values returned from functions registered in the dispatch map when the functions_parameters_type member is set to 'phpvals'.
|
|
string | $response_charset_encoding = '' |
| Charset encoding to be used for response.
|
|
|
static | $_xmlrpc_debuginfo = '' |
|
static | $_xmlrpcs_occurred_errors = '' |
|
static | $_xmlrpcs_prev_ehandler = '' |
|
static | $options |
|
static string | $responseClass = '\\PhpXmlRpc\\Response' |
|
◆ __construct()
PhpXmlRpc\Server::__construct |
( |
| $dispatchMap = null, |
|
|
| $serviceNow = true ) |
- Parameters
-
array[] | $dispatchMap | the dispatch map with definition of exposed services Array keys are the names of the method names. Each array value is an array with the following members:
- function (callable)
- docstring (optional)
- signature (array, optional)
- signature_docs (array, optional)
- parameters_type (string, optional)
- exception_handling (int, optional)
|
boolean | $serviceNow | set to false in order to prevent the server from running upon construction |
◆ _xmlrpcs_errorHandler()
static PhpXmlRpc\Server::_xmlrpcs_errorHandler |
( |
| $errCode, |
|
|
| $errString, |
|
|
| $filename = null, |
|
|
| $lineNo = null, |
|
|
| $context = null ) |
|
static |
Error handler used to track errors that occur during server-side execution of PHP code.
This allows to report back to the client whether an internal error has occurred or not using an xml-rpc response object, instead of letting the client deal with the html junk that a PHP execution error on the server generally entails.
NB: in fact a user defined error handler can only handle WARNING, NOTICE and USER_* errors.
◆ add_to_map()
PhpXmlRpc\Server::add_to_map |
( |
| $methodName, |
|
|
| $function, |
|
|
| $sig = null, |
|
|
| $doc = false, |
|
|
| $sigDoc = false, |
|
|
| $parametersType = false, |
|
|
| $exceptionHandling = false ) |
Add a method to the dispatch map.
- Parameters
-
string | $methodName | the name with which the method will be made available |
callable | $function | the php function that will get invoked |
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 |
string | $doc | method documentation |
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) |
string | $parametersType | to allow single method handlers to receive php values instead of a Request, or vice-versa |
int | $exceptionHandling | |
- See also
- $this->exception_handling
- Return values
-
- Todo
- raise a warning if the user tries to register a 'system.' method
- Deprecated
- use addToMap instead
◆ addToMap()
PhpXmlRpc\Server::addToMap |
( |
| $methodName, |
|
|
| $function, |
|
|
| $sig = null, |
|
|
| $doc = false, |
|
|
| $sigDoc = false, |
|
|
| $parametersType = false, |
|
|
| $exceptionHandling = false ) |
Add a method to the dispatch map.
- Parameters
-
string | $methodName | the name with which the method will be made available |
callable | $function | the php function that will get invoked |
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 |
string | $doc | method documentation |
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) |
string | $parametersType | to allow single method handlers to receive php values instead of a Request, or vice-versa |
int | $exceptionHandling | |
- See also
- $this->exception_handling
- Return values
-
- Todo
- raise a warning if the user tries to register a 'system.' method
◆ debugMsg()
PhpXmlRpc\Server::debugMsg |
( |
| $string | ) |
|
|
protected |
Add a string to the 'internal debug message' (separate from 'user debug message').
- Parameters
-
- Return values
-
◆ error_occurred()
static PhpXmlRpc\Server::error_occurred |
( |
| $msg | ) |
|
|
static |
Add a string to the debug info that will be later serialized by the server as part of the response message (base64 encoded) when debug level >= 2.
- Parameters
-
- Return values
-
◆ execute()
PhpXmlRpc\Server::execute |
( |
| $req, |
|
|
| $params = null, |
|
|
| $paramTypes = null ) |
|
protected |
Execute a method invoked by the client, checking parameters used.
- Parameters
-
Request | string | $req | either a Request obj or a method name |
mixed[] | $params | array with method parameters as php types (only if $req is method name) |
string[] | $paramTypes | array with xml-rpc types of method parameters (only if $req is method name) |
- Return values
-
- Exceptions
-
Exception | in case the executed method does throw an exception (and depending on server configuration) |
◆ getCapabilities()
PhpXmlRpc\Server::getCapabilities |
( |
| ) |
|
◆ getDispatchMap()
PhpXmlRpc\Server::getDispatchMap |
( |
| ) |
|
◆ getOption()
PhpXmlRpc\Server::getOption |
( |
| $name | ) |
|
- Parameters
-
string | $name | see all the OPT_ constants |
- Return values
-
- Exceptions
-
ValueErrorException | on unsupported option |
◆ getOptions()
PhpXmlRpc\Server::getOptions |
( |
| ) |
|
Returns the complete list of Server options.
- Return values
-
◆ getSystemDispatchMap()
PhpXmlRpc\Server::getSystemDispatchMap |
( |
| ) |
|
◆ isSyscall()
PhpXmlRpc\Server::isSyscall |
( |
| $methName | ) |
|
|
protected |
◆ methodNameCallback()
PhpXmlRpc\Server::methodNameCallback |
( |
| $methodName, |
|
|
| $xmlParser, |
|
|
| $parser ) |
Registered as callback for when the XMLParser has found the name of the method to execute.
Handling that early allows to 1. stop parsing the rest of the xml if there is no such method registered, and
- tweak the type of data that the parser will return, in case the server uses mixed-calling-convention
◆ parseRequestHeaders()
PhpXmlRpc\Server::parseRequestHeaders |
( |
& | $data, |
|
|
& | $reqEncoding, |
|
|
& | $respEncoding, |
|
|
& | $respCompression ) |
|
protected |
Parse http headers received along with xml-rpc request.
If needed, inflate request.
- Return values
-
Response|null | null on success or an error Response |
◆ service()
PhpXmlRpc\Server::service |
( |
| $data = null, |
|
|
| $returnPayload = false ) |
Execute the xml-rpc request, printing the response.
- Parameters
-
string | $data | the request body. If null, the http POST request will be examined |
bool | $returnPayload | When true, return the response but do not echo it or any http header |
- Return values
-
Response|string | the response object (usually not used by caller...) or its xml serialization |
- Exceptions
-
Exception | in case the executed method does throw an exception (and depending on server configuration) |
◆ setDebug()
PhpXmlRpc\Server::setDebug |
( |
| $level | ) |
|
Set debug level of server.
- Parameters
-
integer | $level | debug lvl: determines info added to xml-rpc responses (as xml comments) 0 = no debug info, 1 = msgs set from user with debugmsg(), 2 = add complete xml-rpc request (headers and body), 3 = add also all processing warnings happened during method processing (NB: this involves setting a custom error handler, and might interfere with the standard processing of the php function exposed as method. In particular, triggering a USER_ERROR level error will not halt script execution anymore, but just end up logged in the xml-rpc response) Note that info added at level 2 and 3 will be base64 encoded |
- Return values
-
◆ setDispatchMap()
PhpXmlRpc\Server::setDispatchMap |
( |
| $dmap | ) |
|
◆ setOption()
PhpXmlRpc\Server::setOption |
( |
| $name, |
|
|
| $value ) |
- Parameters
-
string | $name | see all the OPT_ constants |
mixed | $value | |
- Return values
-
- Exceptions
-
ValueErrorException | on unsupported option |
◆ setOptions()
PhpXmlRpc\Server::setOptions |
( |
| $options | ) |
|
- Parameters
-
array | $options | key: see all the OPT_ constants |
- Return values
-
- Exceptions
-
ValueErrorException | on unsupported option |
◆ verifySignature()
PhpXmlRpc\Server::verifySignature |
( |
| $in, |
|
|
| $sigs ) |
|
protected |
Verify type and number of parameters received against a list of known signatures.
- Parameters
-
array | Request | $in | array of either xml-rpc value objects or xml-rpc type definitions |
array | $sigs | array of known signatures to match against |
- Return values
-
◆ xml_header()
PhpXmlRpc\Server::xml_header |
( |
| $charsetEncoding = '' | ) |
|
|
protected |
- Parameters
-
- Return values
-
- Deprecated
- this method was moved to the Response class
◆ xmlrpc_debugmsg()
static PhpXmlRpc\Server::xmlrpc_debugmsg |
( |
| $msg | ) |
|
|
static |
Add a string to the debug info that can be later serialized by the server as part of the response message.
Note that for best compatibility, the debug string should be encoded using the PhpXmlRpc\$xmlrpc_internalencoding character set.
- Parameters
-
- Return values
-
◆ $accepted_compression
string [] PhpXmlRpc\Server::$accepted_compression = array() |
|
protected |
List of http compression methods accepted by the server for requests.
Automatically set at constructor time. NB: PHP supports deflate, gzip compressions out of the box if compiled w. zlib
◆ $allow_system_funcs
bool PhpXmlRpc\Server::$allow_system_funcs = true |
|
protected |
Shall we serve calls to system.
◆ $compress_response
bool PhpXmlRpc\Server::$compress_response = false |
|
protected |
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.
Automatically set at constructor time.
◆ $debug
int PhpXmlRpc\Server::$debug = 1 |
|
protected |
Controls whether the server is going to echo debugging messages back to the client as comments in response body.
SECURITY SENSITIVE! Valid values: 0 = 1 = 2 = 3 =
◆ $dmap
array [] PhpXmlRpc\Server::$dmap = array() |
|
protected |
Array defining php functions exposed as xml-rpc methods by this server.
$dmap
◆ $exception_handling
int PhpXmlRpc\Server::$exception_handling = 0 |
|
protected |
Controls behaviour of server when the invoked method-handler function throws an exception (within the execute
method): 0 = catch it and return an 'internal error' xml-rpc response (default) 1 = SECURITY SENSITIVE DO NOT ENABLE ON PUBLIC SERVERS!!! catch it and return an xml-rpc response with the error corresponding to the exception, both its code and message.
2 = allow the exception to float to the upper layers Can be overridden per-method-handler in the dispatch map
◆ $functions_parameters_type
string PhpXmlRpc\Server::$functions_parameters_type = 'xmlrpcvals' |
|
protected |
Defines how functions in $dmap will be invoked: either using an xml-rpc Request object or plain php values.
Valid strings are 'xmlrpcvals', 'phpvals' or 'epivals' (only for use by polyfill-xmlrpc).
- Todo
- create class constants for these
◆ $options
PhpXmlRpc\Server::$options |
|
staticprotected |
Initial value:= array(
self::OPT_ACCEPTED_COMPRESSION,
self::OPT_ALLOW_SYSTEM_FUNCS,
self::OPT_COMPRESS_RESPONSE,
self::OPT_DEBUG,
self::OPT_EXCEPTION_HANDLING,
self::OPT_FUNCTIONS_PARAMETERS_TYPE,
self::OPT_PHPVALS_ENCODING_OPTIONS,
self::OPT_RESPONSE_CHARSET_ENCODING,
)
◆ $phpvals_encoding_options
array PhpXmlRpc\Server::$phpvals_encoding_options = array('auto_dates') |
|
protected |
Option used for fine-tuning the encoding the php values returned from functions registered in the dispatch map when the functions_parameters_type member is set to 'phpvals'.
- See also
- Encoder\encode for a list of values
◆ $response_charset_encoding
string PhpXmlRpc\Server::$response_charset_encoding = '' |
|
protected |
Charset encoding to be used for response.
NB: if we can, we will convert the generated response from internal_encoding to the intended one. Can be:
- a supported xml encoding (only UTF-8 and ISO-8859-1, unless mbstring is enabled),
- null (leave unspecified in response, convert output stream to US_ASCII),
- 'auto' (use client-specified charset encoding or same as request if request headers do not specify it (unless request is US-ASCII: then use library default anyway). NB: pretty dangerous if you accept every charset and do not have mbstring enabled)
◆ $user_data
mixed PhpXmlRpc\Server::$user_data = null |
Extra data passed at runtime to method handling functions.
Used only by EPI layer
The documentation for this class was generated from the following file: