Fix constructors to be compliant with php 7
[plcapi.git] / lib / xmlrpcs.inc
index 6dd64a5..0ab6d54 100644 (file)
                */\r
                var $user_data = null;\r
 \r
+               /**\r
+               * @deprecated\r
+               */\r
+               function xmlrpc_client($dispMap=null, $serviceNow=true)\r
+               {\r
+                       self::__construct($dispMap, $serviceNow);\r
+               }\r
+\r
                /**\r
                * @param array $dispmap the dispatch map with definition of exposed services\r
                * @param boolean $servicenow set to false to prevent the server from running upon construction\r
                */\r
-               function xmlrpc_server($dispMap=null, $serviceNow=true)\r
+               function __construct($dispMap=null, $serviceNow=true)\r
                {\r
                        // if ZLIB is enabled, let the server by default accept compressed requests,\r
                        // and compress responses sent to clients that support them\r
                        if ($data === null)\r
                        {\r
                                // workaround for a known bug in php ver. 5.2.2 that broke $HTTP_RAW_POST_DATA\r
-                $data = file_get_contents('php://input');\r
+                               $data = file_get_contents('php://input');\r
                        }\r
                        $raw_data = $data;\r
 \r
 \r
                        if ($req_encoding != '')\r
                        {\r
-                // Since parsing will fail if charset is not specified in the xml prologue,\r
-                // the encoding is not UTF8 and there are non-ascii chars in the text, we try to work round that...\r
-                // The following code might be better for mb_string enabled installs, but\r
-                // makes the lib about 200% slower...\r
-                //if (!is_valid_charset($req_encoding, array('UTF-8')))\r
-                if (!in_array($req_encoding, array('UTF-8', 'US-ASCII')) && !has_encoding($data)) {\r
-                    if ($req_encoding == 'ISO-8859-1') {\r
-                        $data = utf8_encode($data);\r
-                    } else {\r
-                        if (extension_loaded('mbstring')) {\r
-                            $data = mb_convert_encoding($data, 'UTF-8', $req_encoding);\r
-                        } else {\r
-                            error_log('XML-RPC: ' . __METHOD__ . ': invalid charset encoding of received request: ' . $req_encoding);\r
-                        }\r
-                    }\r
-                }\r
+                               // Since parsing will fail if charset is not specified in the xml prologue,\r
+                               // the encoding is not UTF8 and there are non-ascii chars in the text, we try to work round that...\r
+                               // The following code might be better for mb_string enabled installs, but\r
+                               // makes the lib about 200% slower...\r
+                               //if (!is_valid_charset($req_encoding, array('UTF-8')))\r
+                               if (!in_array($req_encoding, array('UTF-8', 'US-ASCII')) && !has_encoding($data)) {\r
+                                       if ($req_encoding == 'ISO-8859-1') {\r
+                                               $data = utf8_encode($data);\r
+                                       } else {\r
+                                               if (extension_loaded('mbstring')) {\r
+                                                       $data = mb_convert_encoding($data, 'UTF-8', $req_encoding);\r
+                                               } else {\r
+                                                       error_log('XML-RPC: ' . __METHOD__ . ': invalid charset encoding of received request: ' . $req_encoding);\r
+                                               }\r
+                                       }\r
+                               }\r
                        }\r
 \r
                        $parser = xml_parser_create();\r