6 * Manages global configuration for operation of the library.
10 static public $xmlrpcerr = array(
11 'unknown_method' => 1,
12 'invalid_return' => 2,
13 'incorrect_params' => 3,
14 'introspect_unknown' => 4,
19 'invalid_request' => 15,
22 'multicall_error' => 18,
23 'multicall_notstruct' => 9,
24 'multicall_nomethod' => 10,
25 'multicall_notstring' => 11,
26 'multicall_recursion' => 12,
27 'multicall_noparams' => 13,
28 'multicall_notarray' => 14,
30 'cannot_decompress' => 103,
31 'decompress_fail' => 104,
32 'dechunk_fail' => 105,
33 'server_cannot_decompress' => 106,
34 'server_decompress_fail' => 107,
37 static public $xmlrpcstr = array(
38 'unknown_method' => 'Unknown method',
39 'invalid_return' => 'Invalid response payload (you can use the setDebug method to allow analysis of the response)',
40 'incorrect_params' => 'Incorrect parameters passed to method',
41 'introspect_unknown' => "Can't introspect: method unknown",
42 'http_error' => "Didn't receive 200 OK from remote server",
43 'no_data' => 'No data received from server',
44 'no_ssl' => 'No SSL support compiled in',
45 'curl_fail' => 'CURL error',
46 'invalid_request' => 'Invalid request payload',
47 'no_curl' => 'No CURL support compiled in',
48 'server_error' => 'Internal server error',
49 'multicall_error' => 'Received from server invalid multicall response',
50 'multicall_notstruct' => 'system.multicall expected struct',
51 'multicall_nomethod' => 'Missing methodName',
52 'multicall_notstring' => 'methodName is not a string',
53 'multicall_recursion' => 'Recursive system.multicall forbidden',
54 'multicall_noparams' => 'Missing params',
55 'multicall_notarray' => 'params is not an array',
57 'cannot_decompress' => 'Received from server compressed HTTP and cannot decompress',
58 'decompress_fail' => 'Received from server invalid compressed HTTP',
59 'dechunk_fail' => 'Received from server invalid chunked HTTP',
60 'server_cannot_decompress' => 'Received from client compressed HTTP request and cannot decompress',
61 'server_decompress_fail' => 'Received from client invalid compressed HTTP request',
64 // The charset encoding used by the server for received requests and by the client for received responses when
65 // received charset cannot be determined and mbstring extension is not enabled
66 public static $xmlrpc_defencoding = "UTF-8";
68 // The list of encodings used by the server for requests and by the client for responses to detect the charset of
69 // the received payload when
70 // - the charset cannot be determined by looking at http headers, xml declaration or BOM
71 // - mbstring extension is enabled
72 public static $xmlrpc_detectencodings = array();
74 // The encoding used internally by PHP.
75 // String values received as xml will be converted to this, and php strings will be converted to xml as if
76 // having been coded with this.
77 // Valid also when defining names of xmlrpc methods
78 public static $xmlrpc_internalencoding = "UTF-8";
80 public static $xmlrpcName = "XML-RPC for PHP";
81 public static $xmlrpcVersion = "4.4.0";
83 // let user errors start at 800
84 public static $xmlrpcerruser = 800;
85 // let XML parse errors start at 100
86 public static $xmlrpcerrxml = 100;
88 // set to TRUE to enable correct decoding of <NIL/> and <EX:NIL/> values
89 public static $xmlrpc_null_extension = false;
91 // set to TRUE to enable encoding of php NULL values to <EX:NIL/> instead of <NIL/>
92 public static $xmlrpc_null_apache_encoding = false;
94 public static $xmlrpc_null_apache_encoding_ns = "http://ws.apache.org/xmlrpc/namespaces/extensions";
97 * A function to be used for compatibility with legacy code: it creates all global variables which used to be declared,
98 * such as library version etc...
100 public static function exportGlobals()
102 $reflection = new \ReflectionClass('PhpXmlRpc\PhpXmlRpc');
103 foreach ($reflection->getStaticProperties() as $name => $value) {
104 $GLOBALS[$name] = $value;
107 // NB: all the variables exported into the global namespace below here do NOT guarantee 100% compatibility,
108 // as they are NOT reimported back during calls to importGlobals()
110 $reflection = new \ReflectionClass('PhpXmlRpc\Value');
111 foreach ($reflection->getStaticProperties() as $name => $value) {
112 $GLOBALS[$name] = $value;
115 $parser = new Helper\XMLParser();
116 $reflection = new \ReflectionClass('PhpXmlRpc\Helper\XMLParser');
117 foreach ($reflection->getProperties(\ReflectionProperty::IS_PUBLIC) as $name => $value) {
118 if (in_array($value->getName(), array('xmlrpc_valid_parents')))
120 $GLOBALS[$value->getName()] = $value->getValue($parser);
124 $charset = Helper\Charset::instance();
125 $GLOBALS['xml_iso88591_Entities'] = $charset->getEntities('iso88591');
129 * A function to be used for compatibility with legacy code: it gets the values of all global variables which used
130 * to be declared, such as library version etc... and sets them to php classes.
131 * It should be used by code which changed the values of those global variables to alter the working of the library.
133 * 1. include xmlrpc.inc
134 * 2. set the values, e.g. $GLOBALS['xmlrpc_internalencoding'] = 'UTF-8';
135 * 3. import them: PhpXmlRpc\PhpXmlRpc::importGlobals();
136 * 4. run your own code.
138 public static function importGlobals()
140 $reflection = new \ReflectionClass('PhpXmlRpc\PhpXmlRpc');
141 $staticProperties = $reflection->getStaticProperties();
142 foreach ($staticProperties as $name => $value) {
143 if (isset($GLOBALS[$name])) {
144 self::$$name = $GLOBALS[$name];