Fix: encode entities in remote method names so that client can call LATIN-1 and UTF...
[plcapi.git] / lib / xmlrpc.inc
index ea775f8..117c7b8 100644 (file)
                                {\r
                                        curl_setopt($curl, CURLOPT_SSLKEYPASSWD, $keypass);\r
                                }\r
+\r
+                // Upgrade transparently to more stringent check for versions of php which do not support otherwise.\r
+                // Doing it in constructor would be cleaner; doing it here saves us a couple of function calls\r
+                if($this->verifyhost == 1 && $info = curl_version() && version_compare($info['version'], '7.28.1') >= 0)\r
+                {\r
+                    $this->verifyhost = 2;\r
+                }\r
                                // whether to verify cert's common name (CN); 0 for no, 1 to verify that it exists, and 2 to verify that it matches the hostname used\r
                                curl_setopt($curl, CURLOPT_SSL_VERIFYHOST, $this->verifyhost);\r
                        }\r
@@ -2169,7 +2176,7 @@ xmlrpc_encode_entitites($this->errstr, $GLOBALS['xmlrpc_internalencoding'], $cha
                        else\r
                                $this->content_type = 'text/xml';\r
                        $this->payload=$this->xml_header($charset_encoding);\r
-                       $this->payload.='<methodName>' . $this->methodname . "</methodName>\n";\r
+                       $this->payload.='<methodName>' . xmlrpc_encode_entitites($this->methodname, $GLOBALS['xmlrpc_internalencoding'], $charset_encoding) . "</methodName>\n";\r
                        $this->payload.="<params>\n";\r
                        for($i=0; $i<count($this->params); $i++)\r
                        {\r