@@ -1,11 +1,11 @@ discard block |
||
1 | 1 | <?php |
2 | 2 | |
3 | -include_once __DIR__ . '/../lib/xmlrpc.inc'; |
|
4 | -include_once __DIR__ . '/../lib/xmlrpcs.inc'; |
|
3 | +include_once __DIR__.'/../lib/xmlrpc.inc'; |
|
4 | +include_once __DIR__.'/../lib/xmlrpcs.inc'; |
|
5 | 5 | |
6 | -include_once __DIR__ . '/parse_args.php'; |
|
6 | +include_once __DIR__.'/parse_args.php'; |
|
7 | 7 | |
8 | -include_once __DIR__ . '/PolyfillTestCase.php'; |
|
8 | +include_once __DIR__.'/PolyfillTestCase.php'; |
|
9 | 9 | |
10 | 10 | use PHPUnit\Runner\BaseTestRunner; |
11 | 11 | |
@@ -103,7 +103,7 @@ discard block |
||
103 | 103 | /// @todo it seems that old php versions can not automatically transform latin to utf8 upon xml parsing. |
104 | 104 | /// We should fix that, then re-enable this test |
105 | 105 | if (version_compare(PHP_VERSION, '5.6.0', '>=')) { |
106 | - $i = $e->decodeXml('<?xml version="1.0" encoding="ISO-8859-15" ?><value><string>' . $string . '</string></value>'); |
|
106 | + $i = $e->decodeXml('<?xml version="1.0" encoding="ISO-8859-15" ?><value><string>'.$string.'</string></value>'); |
|
107 | 107 | $this->assertEquals($string, $i->scalarVal()); |
108 | 108 | } |
109 | 109 |
@@ -189,10 +189,10 @@ discard block |
||
189 | 189 | $server = $parts['host']; |
190 | 190 | $path = isset($parts['path']) ? $parts['path'] : ''; |
191 | 191 | if (isset($parts['query'])) { |
192 | - $path .= '?' . $parts['query']; |
|
192 | + $path .= '?'.$parts['query']; |
|
193 | 193 | } |
194 | 194 | if (isset($parts['fragment'])) { |
195 | - $path .= '#' . $parts['fragment']; |
|
195 | + $path .= '#'.$parts['fragment']; |
|
196 | 196 | } |
197 | 197 | if (isset($parts['port'])) { |
198 | 198 | $port = $parts['port']; |
@@ -208,7 +208,7 @@ discard block |
||
208 | 208 | } |
209 | 209 | } |
210 | 210 | if ($path == '' || $path[0] != '/') { |
211 | - $this->path = '/' . $path; |
|
211 | + $this->path = '/'.$path; |
|
212 | 212 | } else { |
213 | 213 | $this->path = $path; |
214 | 214 | } |
@@ -246,7 +246,7 @@ discard block |
||
246 | 246 | }*/ |
247 | 247 | |
248 | 248 | // initialize user_agent string |
249 | - $this->user_agent = PhpXmlRpc::$xmlrpcName . ' ' . PhpXmlRpc::$xmlrpcVersion; |
|
249 | + $this->user_agent = PhpXmlRpc::$xmlrpcName.' '.PhpXmlRpc::$xmlrpcVersion; |
|
250 | 250 | } |
251 | 251 | |
252 | 252 | /** |
@@ -670,7 +670,7 @@ discard block |
||
670 | 670 | */ |
671 | 671 | protected function sendPayloadHTTP10($req, $server, $port, $timeout = 0, $username = '', $password = '', |
672 | 672 | $authType = 1, $proxyHost = '', $proxyPort = 0, $proxyUsername = '', $proxyPassword = '', $proxyAuthType = 1, |
673 | - $method='http') |
|
673 | + $method = 'http') |
|
674 | 674 | { |
675 | 675 | //trigger_error('Method ' . __METHOD__ . ' is deprecated', E_USER_DEPRECATED); |
676 | 676 | |
@@ -703,7 +703,7 @@ discard block |
||
703 | 703 | * @param int $sslVersion |
704 | 704 | * @return Response |
705 | 705 | */ |
706 | - protected function sendPayloadHTTPS($req, $server, $port, $timeout = 0, $username = '', $password = '', |
|
706 | + protected function sendPayloadHTTPS($req, $server, $port, $timeout = 0, $username = '', $password = '', |
|
707 | 707 | $authType = 1, $cert = '', $certPass = '', $caCert = '', $caCertDir = '', $proxyHost = '', $proxyPort = 0, |
708 | 708 | $proxyUsername = '', $proxyPassword = '', $proxyAuthType = 1, $keepAlive = false, $key = '', $keyPass = '', |
709 | 709 | $sslVersion = 0) |
@@ -742,7 +742,7 @@ discard block |
||
742 | 742 | */ |
743 | 743 | protected function sendPayloadSocket($req, $server, $port, $timeout = 0, $username = '', $password = '', |
744 | 744 | $authType = 1, $cert = '', $certPass = '', $caCert = '', $caCertDir = '', $proxyHost = '', $proxyPort = 0, |
745 | - $proxyUsername = '', $proxyPassword = '', $proxyAuthType = 1, $method='http', $key = '', $keyPass = '', |
|
745 | + $proxyUsername = '', $proxyPassword = '', $proxyAuthType = 1, $method = 'http', $key = '', $keyPass = '', |
|
746 | 746 | $sslVersion = 0) |
747 | 747 | { |
748 | 748 | /// @todo log a warning if passed an unsupported method |
@@ -779,16 +779,16 @@ discard block |
||
779 | 779 | // thanks to Grant Rauscher <[email protected]> for this |
780 | 780 | $credentials = ''; |
781 | 781 | if ($username != '') { |
782 | - $credentials = 'Authorization: Basic ' . base64_encode($username . ':' . $password) . "\r\n"; |
|
782 | + $credentials = 'Authorization: Basic '.base64_encode($username.':'.$password)."\r\n"; |
|
783 | 783 | if ($authType != 1) { |
784 | 784 | /// @todo make this a proper error, i.e. return a failure |
785 | - $this->getLogger()->errorLog('XML-RPC: ' . __METHOD__ . ': warning. Only Basic auth is supported with HTTP 1.0'); |
|
785 | + $this->getLogger()->errorLog('XML-RPC: '.__METHOD__.': warning. Only Basic auth is supported with HTTP 1.0'); |
|
786 | 786 | } |
787 | 787 | } |
788 | 788 | |
789 | 789 | $acceptedEncoding = ''; |
790 | 790 | if (is_array($this->accepted_compression) && count($this->accepted_compression)) { |
791 | - $acceptedEncoding = 'Accept-Encoding: ' . implode(', ', $this->accepted_compression) . "\r\n"; |
|
791 | + $acceptedEncoding = 'Accept-Encoding: '.implode(', ', $this->accepted_compression)."\r\n"; |
|
792 | 792 | } |
793 | 793 | |
794 | 794 | $proxyCredentials = ''; |
@@ -800,13 +800,13 @@ discard block |
||
800 | 800 | $connectPort = $proxyPort; |
801 | 801 | $transport = 'tcp'; |
802 | 802 | /// @todo check: should we not use https in some cases? |
803 | - $uri = 'http://' . $server . ':' . $port . $this->path; |
|
803 | + $uri = 'http://'.$server.':'.$port.$this->path; |
|
804 | 804 | if ($proxyUsername != '') { |
805 | 805 | if ($proxyAuthType != 1) { |
806 | 806 | /// @todo make this a proper error, i.e. return a failure |
807 | - $this->getLogger()->errorLog('XML-RPC: ' . __METHOD__ . ': warning. Only Basic auth to proxy is supported with HTTP 1.0'); |
|
807 | + $this->getLogger()->errorLog('XML-RPC: '.__METHOD__.': warning. Only Basic auth to proxy is supported with HTTP 1.0'); |
|
808 | 808 | } |
809 | - $proxyCredentials = 'Proxy-Authorization: Basic ' . base64_encode($proxyUsername . ':' . $proxyPassword) . "\r\n"; |
|
809 | + $proxyCredentials = 'Proxy-Authorization: Basic '.base64_encode($proxyUsername.':'.$proxyPassword)."\r\n"; |
|
810 | 810 | } |
811 | 811 | } else { |
812 | 812 | $connectServer = $server; |
@@ -821,45 +821,45 @@ discard block |
||
821 | 821 | $version = ''; |
822 | 822 | foreach ($this->cookies as $name => $cookie) { |
823 | 823 | if ($cookie['version']) { |
824 | - $version = ' $Version="' . $cookie['version'] . '";'; |
|
825 | - $cookieHeader .= ' ' . $name . '="' . $cookie['value'] . '";'; |
|
824 | + $version = ' $Version="'.$cookie['version'].'";'; |
|
825 | + $cookieHeader .= ' '.$name.'="'.$cookie['value'].'";'; |
|
826 | 826 | if ($cookie['path']) { |
827 | - $cookieHeader .= ' $Path="' . $cookie['path'] . '";'; |
|
827 | + $cookieHeader .= ' $Path="'.$cookie['path'].'";'; |
|
828 | 828 | } |
829 | 829 | if ($cookie['domain']) { |
830 | - $cookieHeader .= ' $Domain="' . $cookie['domain'] . '";'; |
|
830 | + $cookieHeader .= ' $Domain="'.$cookie['domain'].'";'; |
|
831 | 831 | } |
832 | 832 | if ($cookie['port']) { |
833 | - $cookieHeader .= ' $Port="' . $cookie['port'] . '";'; |
|
833 | + $cookieHeader .= ' $Port="'.$cookie['port'].'";'; |
|
834 | 834 | } |
835 | 835 | } else { |
836 | - $cookieHeader .= ' ' . $name . '=' . $cookie['value'] . ";"; |
|
836 | + $cookieHeader .= ' '.$name.'='.$cookie['value'].";"; |
|
837 | 837 | } |
838 | 838 | } |
839 | - $cookieHeader = 'Cookie:' . $version . substr($cookieHeader, 0, -1) . "\r\n"; |
|
839 | + $cookieHeader = 'Cookie:'.$version.substr($cookieHeader, 0, -1)."\r\n"; |
|
840 | 840 | } |
841 | 841 | |
842 | 842 | // omit port if default |
843 | 843 | if (($port == 80 && in_array($method, array('http', 'http10'))) || ($port == 443 && $method == 'https')) { |
844 | - $port = ''; |
|
844 | + $port = ''; |
|
845 | 845 | } else { |
846 | - $port = ':' . $port; |
|
846 | + $port = ':'.$port; |
|
847 | 847 | } |
848 | 848 | |
849 | - $op = 'POST ' . $uri . " HTTP/1.0\r\n" . |
|
850 | - 'User-Agent: ' . $this->user_agent . "\r\n" . |
|
851 | - 'Host: ' . $server . $port . "\r\n" . |
|
852 | - $credentials . |
|
853 | - $proxyCredentials . |
|
854 | - $acceptedEncoding . |
|
855 | - $encodingHdr . |
|
856 | - 'Accept-Charset: ' . implode(',', $this->accepted_charset_encodings) . "\r\n" . |
|
857 | - $cookieHeader . |
|
858 | - 'Content-Type: ' . $req->content_type . "\r\nContent-Length: " . |
|
859 | - strlen($payload) . "\r\n\r\n" . |
|
849 | + $op = 'POST '.$uri." HTTP/1.0\r\n". |
|
850 | + 'User-Agent: '.$this->user_agent."\r\n". |
|
851 | + 'Host: '.$server.$port."\r\n". |
|
852 | + $credentials. |
|
853 | + $proxyCredentials. |
|
854 | + $acceptedEncoding. |
|
855 | + $encodingHdr. |
|
856 | + 'Accept-Charset: '.implode(',', $this->accepted_charset_encodings)."\r\n". |
|
857 | + $cookieHeader. |
|
858 | + 'Content-Type: '.$req->content_type."\r\nContent-Length: ". |
|
859 | + strlen($payload)."\r\n\r\n". |
|
860 | 860 | $payload; |
861 | 861 | |
862 | - if ($this->debug > 1) { |
|
862 | + if ($this->debug>1) { |
|
863 | 863 | $this->getLogger()->debugMessage("---SENDING---\n$op\n---END---"); |
864 | 864 | } |
865 | 865 | |
@@ -886,7 +886,7 @@ discard block |
||
886 | 886 | |
887 | 887 | $context = stream_context_create($contextOptions); |
888 | 888 | |
889 | - if ($timeout <= 0) { |
|
889 | + if ($timeout<=0) { |
|
890 | 890 | $connectTimeout = ini_get('default_socket_timeout'); |
891 | 891 | } else { |
892 | 892 | $connectTimeout = $timeout; |
@@ -898,7 +898,7 @@ discard block |
||
898 | 898 | $fp = @stream_socket_client("$transport://$connectServer:$connectPort", $this->errno, $this->errstr, $connectTimeout, |
899 | 899 | STREAM_CLIENT_CONNECT, $context); |
900 | 900 | if ($fp) { |
901 | - if ($timeout > 0) { |
|
901 | + if ($timeout>0) { |
|
902 | 902 | stream_set_timeout($fp, $timeout, 0); |
903 | 903 | } |
904 | 904 | } else { |
@@ -907,8 +907,8 @@ discard block |
||
907 | 907 | $this->errstr = $err['message']; |
908 | 908 | } |
909 | 909 | |
910 | - $this->errstr = 'Connect error: ' . $this->errstr; |
|
911 | - $r = new Response(0, PhpXmlRpc::$xmlrpcerr['http_error'], $this->errstr . ' (' . $this->errno . ')'); |
|
910 | + $this->errstr = 'Connect error: '.$this->errstr; |
|
911 | + $r = new Response(0, PhpXmlRpc::$xmlrpcerr['http_error'], $this->errstr.' ('.$this->errno.')'); |
|
912 | 912 | |
913 | 913 | return $r; |
914 | 914 | } |
@@ -996,18 +996,18 @@ discard block |
||
996 | 996 | $keyPass, $sslVersion); |
997 | 997 | |
998 | 998 | if (!$curl) { |
999 | - return new Response(0, PhpXmlRpc::$xmlrpcerr['curl_fail'], PhpXmlRpc::$xmlrpcstr['curl_fail'] . ': error during curl initialization. Check php error log for details'); |
|
999 | + return new Response(0, PhpXmlRpc::$xmlrpcerr['curl_fail'], PhpXmlRpc::$xmlrpcstr['curl_fail'].': error during curl initialization. Check php error log for details'); |
|
1000 | 1000 | } |
1001 | 1001 | |
1002 | 1002 | $result = curl_exec($curl); |
1003 | 1003 | |
1004 | - if ($this->debug > 1) { |
|
1004 | + if ($this->debug>1) { |
|
1005 | 1005 | $message = "---CURL INFO---\n"; |
1006 | 1006 | foreach (curl_getinfo($curl) as $name => $val) { |
1007 | 1007 | if (is_array($val)) { |
1008 | 1008 | $val = implode("\n", $val); |
1009 | 1009 | } |
1010 | - $message .= $name . ': ' . $val . "\n"; |
|
1010 | + $message .= $name.': '.$val."\n"; |
|
1011 | 1011 | } |
1012 | 1012 | $message .= '---END---'; |
1013 | 1013 | $this->getLogger()->debugMessage($message); |
@@ -1017,7 +1017,7 @@ discard block |
||
1017 | 1017 | /// @todo we should use a better check here - what if we get back '' or '0'? |
1018 | 1018 | |
1019 | 1019 | $this->errstr = 'no response'; |
1020 | - $resp = new Response(0, PhpXmlRpc::$xmlrpcerr['curl_fail'], PhpXmlRpc::$xmlrpcstr['curl_fail'] . ': ' . curl_error($curl)); |
|
1020 | + $resp = new Response(0, PhpXmlRpc::$xmlrpcerr['curl_fail'], PhpXmlRpc::$xmlrpcstr['curl_fail'].': '.curl_error($curl)); |
|
1021 | 1021 | curl_close($curl); |
1022 | 1022 | if ($keepAlive) { |
1023 | 1023 | $this->xmlrpc_curl_handle = null; |
@@ -1087,12 +1087,12 @@ discard block |
||
1087 | 1087 | // http, https |
1088 | 1088 | $protocol = $method; |
1089 | 1089 | if (strpos($protocol, ':') !== false) { |
1090 | - $this->getLogger()->errorLog('XML-RPC: ' . __METHOD__ . ": warning - attempted hacking attempt?. The curl protocol requested for the call is: '$protocol'"); |
|
1090 | + $this->getLogger()->errorLog('XML-RPC: '.__METHOD__.": warning - attempted hacking attempt?. The curl protocol requested for the call is: '$protocol'"); |
|
1091 | 1091 | return false; |
1092 | 1092 | } |
1093 | 1093 | } |
1094 | 1094 | } |
1095 | - $curl = curl_init($protocol . '://' . $server . ':' . $port . $this->path); |
|
1095 | + $curl = curl_init($protocol.'://'.$server.':'.$port.$this->path); |
|
1096 | 1096 | if (!$curl) { |
1097 | 1097 | return false; |
1098 | 1098 | } |
@@ -1106,7 +1106,7 @@ discard block |
||
1106 | 1106 | // results into variable |
1107 | 1107 | curl_setopt($curl, CURLOPT_RETURNTRANSFER, true); |
1108 | 1108 | |
1109 | - if ($this->debug > 1) { |
|
1109 | + if ($this->debug>1) { |
|
1110 | 1110 | curl_setopt($curl, CURLOPT_VERBOSE, true); |
1111 | 1111 | /// @todo allow callers to redirect curlopt_stderr to some stream which can be buffered |
1112 | 1112 | } |
@@ -1131,7 +1131,7 @@ discard block |
||
1131 | 1131 | } |
1132 | 1132 | } |
1133 | 1133 | // extra headers |
1134 | - $headers = array('Content-Type: ' . $req->content_type, 'Accept-Charset: ' . implode(',', $this->accepted_charset_encodings)); |
|
1134 | + $headers = array('Content-Type: '.$req->content_type, 'Accept-Charset: '.implode(',', $this->accepted_charset_encodings)); |
|
1135 | 1135 | // if no keepalive is wanted, let the server know it in advance |
1136 | 1136 | if (!$keepAlive) { |
1137 | 1137 | $headers[] = 'Connection: close'; |
@@ -1148,7 +1148,7 @@ discard block |
||
1148 | 1148 | curl_setopt($curl, CURLOPT_HTTPHEADER, $headers); |
1149 | 1149 | // timeout is borked |
1150 | 1150 | if ($timeout) { |
1151 | - curl_setopt($curl, CURLOPT_TIMEOUT, $timeout == 1 ? 1 : $timeout - 1); |
|
1151 | + curl_setopt($curl, CURLOPT_TIMEOUT, $timeout == 1 ? 1 : $timeout-1); |
|
1152 | 1152 | } |
1153 | 1153 | |
1154 | 1154 | switch ($method) { |
@@ -1163,7 +1163,7 @@ discard block |
||
1163 | 1163 | curl_setopt($curl, CURLOPT_HTTP_VERSION, CURL_HTTP_VERSION_2_PRIOR_KNOWLEDGE); |
1164 | 1164 | } else { |
1165 | 1165 | /// @todo make this a proper error, i.e. return a failure |
1166 | - $this->getLogger()->errorLog('XML-RPC: ' . __METHOD__ . ': warning. HTTP2 is not supported by the current PHP/curl install'); |
|
1166 | + $this->getLogger()->errorLog('XML-RPC: '.__METHOD__.': warning. HTTP2 is not supported by the current PHP/curl install'); |
|
1167 | 1167 | } |
1168 | 1168 | break; |
1169 | 1169 | case 'h2': |
@@ -1172,12 +1172,12 @@ discard block |
||
1172 | 1172 | } |
1173 | 1173 | |
1174 | 1174 | if ($username && $password) { |
1175 | - curl_setopt($curl, CURLOPT_USERPWD, $username . ':' . $password); |
|
1175 | + curl_setopt($curl, CURLOPT_USERPWD, $username.':'.$password); |
|
1176 | 1176 | if (defined('CURLOPT_HTTPAUTH')) { |
1177 | 1177 | curl_setopt($curl, CURLOPT_HTTPAUTH, $authType); |
1178 | 1178 | } elseif ($authType != 1) { |
1179 | 1179 | /// @todo make this a proper error, i.e. return a failure |
1180 | - $this->getLogger()->errorLog('XML-RPC: ' . __METHOD__ . ': warning. Only Basic auth is supported by the current PHP/curl install'); |
|
1180 | + $this->getLogger()->errorLog('XML-RPC: '.__METHOD__.': warning. Only Basic auth is supported by the current PHP/curl install'); |
|
1181 | 1181 | } |
1182 | 1182 | } |
1183 | 1183 | |
@@ -1220,14 +1220,14 @@ discard block |
||
1220 | 1220 | if ($proxyPort == 0) { |
1221 | 1221 | $proxyPort = 8080; // NB: even for HTTPS, local connection is on port 8080 |
1222 | 1222 | } |
1223 | - curl_setopt($curl, CURLOPT_PROXY, $proxyHost . ':' . $proxyPort); |
|
1223 | + curl_setopt($curl, CURLOPT_PROXY, $proxyHost.':'.$proxyPort); |
|
1224 | 1224 | if ($proxyUsername) { |
1225 | - curl_setopt($curl, CURLOPT_PROXYUSERPWD, $proxyUsername . ':' . $proxyPassword); |
|
1225 | + curl_setopt($curl, CURLOPT_PROXYUSERPWD, $proxyUsername.':'.$proxyPassword); |
|
1226 | 1226 | if (defined('CURLOPT_PROXYAUTH')) { |
1227 | 1227 | curl_setopt($curl, CURLOPT_PROXYAUTH, $proxyAuthType); |
1228 | 1228 | } elseif ($proxyAuthType != 1) { |
1229 | 1229 | /// @todo make this a proper error, i.e. return a failure |
1230 | - $this->getLogger()->errorLog('XML-RPC: ' . __METHOD__ . ': warning. Only Basic auth to proxy is supported by the current PHP/curl install'); |
|
1230 | + $this->getLogger()->errorLog('XML-RPC: '.__METHOD__.': warning. Only Basic auth to proxy is supported by the current PHP/curl install'); |
|
1231 | 1231 | } |
1232 | 1232 | } |
1233 | 1233 | } |
@@ -1237,7 +1237,7 @@ discard block |
||
1237 | 1237 | if (count($this->cookies)) { |
1238 | 1238 | $cookieHeader = ''; |
1239 | 1239 | foreach ($this->cookies as $name => $cookie) { |
1240 | - $cookieHeader .= $name . '=' . $cookie['value'] . '; '; |
|
1240 | + $cookieHeader .= $name.'='.$cookie['value'].'; '; |
|
1241 | 1241 | } |
1242 | 1242 | curl_setopt($curl, CURLOPT_COOKIE, substr($cookieHeader, 0, -2)); |
1243 | 1243 | } |
@@ -1246,7 +1246,7 @@ discard block |
||
1246 | 1246 | curl_setopt($curl, $opt, $val); |
1247 | 1247 | } |
1248 | 1248 | |
1249 | - if ($this->debug > 1) { |
|
1249 | + if ($this->debug>1) { |
|
1250 | 1250 | $this->getLogger()->debugMessage("---SENDING---\n$payload\n---END---"); |
1251 | 1251 | } |
1252 | 1252 | |
@@ -1337,7 +1337,7 @@ discard block |
||
1337 | 1337 | $call['methodName'] = new Value($req->method(), 'string'); |
1338 | 1338 | $numParams = $req->getNumParams(); |
1339 | 1339 | $params = array(); |
1340 | - for ($i = 0; $i < $numParams; $i++) { |
|
1340 | + for ($i = 0; $i<$numParams; $i++) { |
|
1341 | 1341 | $params[$i] = $req->getParam($i); |
1342 | 1342 | } |
1343 | 1343 | $call['params'] = new Value($params, 'array'); |
@@ -1359,7 +1359,7 @@ discard block |
||
1359 | 1359 | $response = array(); |
1360 | 1360 | |
1361 | 1361 | if ($this->return_type == 'xml') { |
1362 | - for ($i = 0; $i < count($reqs); $i++) { |
|
1362 | + for ($i = 0; $i<count($reqs); $i++) { |
|
1363 | 1363 | $response[] = new Response($rets, 0, '', 'xml', $result->httpResponse()); |
1364 | 1364 | } |
1365 | 1365 | |
@@ -1367,21 +1367,21 @@ discard block |
||
1367 | 1367 | if (!is_array($rets)) { |
1368 | 1368 | // bad return type from system.multicall |
1369 | 1369 | return new Response(0, PhpXmlRpc::$xmlrpcerr['multicall_error'], |
1370 | - PhpXmlRpc::$xmlrpcstr['multicall_error'] . ': not an array', 'phpvals', $result->httpResponse()); |
|
1370 | + PhpXmlRpc::$xmlrpcstr['multicall_error'].': not an array', 'phpvals', $result->httpResponse()); |
|
1371 | 1371 | } |
1372 | 1372 | $numRets = count($rets); |
1373 | 1373 | if ($numRets != count($reqs)) { |
1374 | 1374 | // wrong number of return values. |
1375 | 1375 | return new Response(0, PhpXmlRpc::$xmlrpcerr['multicall_error'], |
1376 | - PhpXmlRpc::$xmlrpcstr['multicall_error'] . ': incorrect number of responses', 'phpvals', |
|
1376 | + PhpXmlRpc::$xmlrpcstr['multicall_error'].': incorrect number of responses', 'phpvals', |
|
1377 | 1377 | $result->httpResponse()); |
1378 | 1378 | } |
1379 | 1379 | |
1380 | - for ($i = 0; $i < $numRets; $i++) { |
|
1380 | + for ($i = 0; $i<$numRets; $i++) { |
|
1381 | 1381 | $val = $rets[$i]; |
1382 | 1382 | if (!is_array($val)) { |
1383 | 1383 | return new Response(0, PhpXmlRpc::$xmlrpcerr['multicall_error'], |
1384 | - PhpXmlRpc::$xmlrpcstr['multicall_error'] . ": response element $i is not an array or struct", |
|
1384 | + PhpXmlRpc::$xmlrpcstr['multicall_error'].": response element $i is not an array or struct", |
|
1385 | 1385 | 'phpvals', $result->httpResponse()); |
1386 | 1386 | } |
1387 | 1387 | switch (count($val)) { |
@@ -1389,7 +1389,7 @@ discard block |
||
1389 | 1389 | if (!isset($val[0])) { |
1390 | 1390 | // Bad value |
1391 | 1391 | return new Response(0, PhpXmlRpc::$xmlrpcerr['multicall_error'], |
1392 | - PhpXmlRpc::$xmlrpcstr['multicall_error'] . ": response element $i has no value", |
|
1392 | + PhpXmlRpc::$xmlrpcstr['multicall_error'].": response element $i has no value", |
|
1393 | 1393 | 'phpvals', $result->httpResponse()); |
1394 | 1394 | } |
1395 | 1395 | // Normal return value |
@@ -1401,20 +1401,20 @@ discard block |
||
1401 | 1401 | if (!is_int($code)) { |
1402 | 1402 | /// @todo should we check that it is != 0? |
1403 | 1403 | return new Response(0, PhpXmlRpc::$xmlrpcerr['multicall_error'], |
1404 | - PhpXmlRpc::$xmlrpcstr['multicall_error'] . ": response element $i has invalid or no faultCode", |
|
1404 | + PhpXmlRpc::$xmlrpcstr['multicall_error'].": response element $i has invalid or no faultCode", |
|
1405 | 1405 | 'phpvals', $result->httpResponse()); |
1406 | 1406 | } |
1407 | 1407 | $str = @$val['faultString']; |
1408 | 1408 | if (!is_string($str)) { |
1409 | 1409 | return new Response(0, PhpXmlRpc::$xmlrpcerr['multicall_error'], |
1410 | - PhpXmlRpc::$xmlrpcstr['multicall_error'] . ": response element $i has invalid or no FaultString", |
|
1410 | + PhpXmlRpc::$xmlrpcstr['multicall_error'].": response element $i has invalid or no FaultString", |
|
1411 | 1411 | 'phpvals', $result->httpResponse()); |
1412 | 1412 | } |
1413 | 1413 | $response[$i] = new Response(0, $code, $str, 'phpvals', $result->httpResponse()); |
1414 | 1414 | break; |
1415 | 1415 | default: |
1416 | 1416 | return new Response(0, PhpXmlRpc::$xmlrpcerr['multicall_error'], |
1417 | - PhpXmlRpc::$xmlrpcstr['multicall_error'] . ": response element $i has too many items", |
|
1417 | + PhpXmlRpc::$xmlrpcstr['multicall_error'].": response element $i has too many items", |
|
1418 | 1418 | 'phpvals', $result->httpResponse()); |
1419 | 1419 | } |
1420 | 1420 | } |
@@ -1423,14 +1423,14 @@ discard block |
||
1423 | 1423 | // return type == 'xmlrpcvals' |
1424 | 1424 | if ($rets->kindOf() != 'array') { |
1425 | 1425 | return new Response(0, PhpXmlRpc::$xmlrpcerr['multicall_error'], |
1426 | - PhpXmlRpc::$xmlrpcstr['multicall_error'] . ": response element $i is not an array", 'xmlrpcvals', |
|
1426 | + PhpXmlRpc::$xmlrpcstr['multicall_error'].": response element $i is not an array", 'xmlrpcvals', |
|
1427 | 1427 | $result->httpResponse()); |
1428 | 1428 | } |
1429 | 1429 | $numRets = $rets->count(); |
1430 | 1430 | if ($numRets != count($reqs)) { |
1431 | 1431 | // wrong number of return values. |
1432 | 1432 | return new Response(0, PhpXmlRpc::$xmlrpcerr['multicall_error'], |
1433 | - PhpXmlRpc::$xmlrpcstr['multicall_error'] . ': incorrect number of responses', 'xmlrpcvals', |
|
1433 | + PhpXmlRpc::$xmlrpcstr['multicall_error'].': incorrect number of responses', 'xmlrpcvals', |
|
1434 | 1434 | $result->httpResponse()); |
1435 | 1435 | } |
1436 | 1436 | |
@@ -1439,7 +1439,7 @@ discard block |
||
1439 | 1439 | case 'array': |
1440 | 1440 | if ($val->count() != 1) { |
1441 | 1441 | return new Response(0, PhpXmlRpc::$xmlrpcerr['multicall_error'], |
1442 | - PhpXmlRpc::$xmlrpcstr['multicall_error'] . ": response element $i has too many items", |
|
1442 | + PhpXmlRpc::$xmlrpcstr['multicall_error'].": response element $i has too many items", |
|
1443 | 1443 | 'phpvals', $result->httpResponse()); |
1444 | 1444 | } |
1445 | 1445 | // Normal return value |
@@ -1448,28 +1448,28 @@ discard block |
||
1448 | 1448 | case 'struct': |
1449 | 1449 | if ($val->count() != 2) { |
1450 | 1450 | return new Response(0, PhpXmlRpc::$xmlrpcerr['multicall_error'], |
1451 | - PhpXmlRpc::$xmlrpcstr['multicall_error'] . ": response element $i has too many items", |
|
1451 | + PhpXmlRpc::$xmlrpcstr['multicall_error'].": response element $i has too many items", |
|
1452 | 1452 | 'phpvals', $result->httpResponse()); |
1453 | 1453 | } |
1454 | 1454 | /** @var Value $code */ |
1455 | 1455 | $code = $val['faultCode']; |
1456 | 1456 | if ($code->kindOf() != 'scalar' || $code->scalartyp() != 'int') { |
1457 | 1457 | return new Response(0, PhpXmlRpc::$xmlrpcerr['multicall_error'], |
1458 | - PhpXmlRpc::$xmlrpcstr['multicall_error'] . ": response element $i has invalid or no faultCode", |
|
1458 | + PhpXmlRpc::$xmlrpcstr['multicall_error'].": response element $i has invalid or no faultCode", |
|
1459 | 1459 | 'xmlrpcvals', $result->httpResponse()); |
1460 | 1460 | } |
1461 | 1461 | /** @var Value $str */ |
1462 | 1462 | $str = $val['faultString']; |
1463 | 1463 | if ($str->kindOf() != 'scalar' || $str->scalartyp() != 'string') { |
1464 | 1464 | return new Response(0, PhpXmlRpc::$xmlrpcerr['multicall_error'], |
1465 | - PhpXmlRpc::$xmlrpcstr['multicall_error'] . ": response element $i has invalid or no faultCode", |
|
1465 | + PhpXmlRpc::$xmlrpcstr['multicall_error'].": response element $i has invalid or no faultCode", |
|
1466 | 1466 | 'xmlrpcvals', $result->httpResponse()); |
1467 | 1467 | } |
1468 | 1468 | $response[] = new Response(0, $code->scalarval(), $str->scalarval(), 'xmlrpcvals', $result->httpResponse()); |
1469 | 1469 | break; |
1470 | 1470 | default: |
1471 | 1471 | return new Response(0, PhpXmlRpc::$xmlrpcerr['multicall_error'], |
1472 | - PhpXmlRpc::$xmlrpcstr['multicall_error'] . ": response element $i is not an array or struct", |
|
1472 | + PhpXmlRpc::$xmlrpcstr['multicall_error'].": response element $i is not an array or struct", |
|
1473 | 1473 | 'xmlrpcvals', $result->httpResponse()); |
1474 | 1474 | } |
1475 | 1475 | } |
@@ -129,7 +129,7 @@ discard block |
||
129 | 129 | $this->me['struct'] = $val; |
130 | 130 | break; |
131 | 131 | default: |
132 | - $this->getLogger()->errorLog("XML-RPC: " . __METHOD__ . ": not a known type ($type)"); |
|
132 | + $this->getLogger()->errorLog("XML-RPC: ".__METHOD__.": not a known type ($type)"); |
|
133 | 133 | } |
134 | 134 | } |
135 | 135 | } |
@@ -153,7 +153,7 @@ discard block |
||
153 | 153 | } |
154 | 154 | |
155 | 155 | if ($typeOf !== 1) { |
156 | - $this->getLogger()->errorLog("XML-RPC: " . __METHOD__ . ": not a scalar type ($type)"); |
|
156 | + $this->getLogger()->errorLog("XML-RPC: ".__METHOD__.": not a scalar type ($type)"); |
|
157 | 157 | return 0; |
158 | 158 | } |
159 | 159 | |
@@ -170,10 +170,10 @@ discard block |
||
170 | 170 | |
171 | 171 | switch ($this->mytype) { |
172 | 172 | case 1: |
173 | - $this->getLogger()->errorLog('XML-RPC: ' . __METHOD__ . ': scalar xmlrpc value can have only one value'); |
|
173 | + $this->getLogger()->errorLog('XML-RPC: '.__METHOD__.': scalar xmlrpc value can have only one value'); |
|
174 | 174 | return 0; |
175 | 175 | case 3: |
176 | - $this->getLogger()->errorLog('XML-RPC: ' . __METHOD__ . ': cannot add anonymous scalar to struct xmlrpc value'); |
|
176 | + $this->getLogger()->errorLog('XML-RPC: '.__METHOD__.': cannot add anonymous scalar to struct xmlrpc value'); |
|
177 | 177 | return 0; |
178 | 178 | case 2: |
179 | 179 | // we're adding a scalar value to an array here |
@@ -214,7 +214,7 @@ discard block |
||
214 | 214 | |
215 | 215 | return 1; |
216 | 216 | } else { |
217 | - $this->getLogger()->errorLog('XML-RPC: ' . __METHOD__ . ': already initialized as a [' . $this->kindOf() . ']'); |
|
217 | + $this->getLogger()->errorLog('XML-RPC: '.__METHOD__.': already initialized as a ['.$this->kindOf().']'); |
|
218 | 218 | return 0; |
219 | 219 | } |
220 | 220 | } |
@@ -244,7 +244,7 @@ discard block |
||
244 | 244 | |
245 | 245 | return 1; |
246 | 246 | } else { |
247 | - $this->getLogger()->errorLog('XML-RPC: ' . __METHOD__ . ': already initialized as a [' . $this->kindOf() . ']'); |
|
247 | + $this->getLogger()->errorLog('XML-RPC: '.__METHOD__.': already initialized as a ['.$this->kindOf().']'); |
|
248 | 248 | return 0; |
249 | 249 | } |
250 | 250 | } |
@@ -286,19 +286,19 @@ discard block |
||
286 | 286 | case 1: |
287 | 287 | switch ($typ) { |
288 | 288 | case static::$xmlrpcBase64: |
289 | - $rs .= "<{$typ}>" . base64_encode($val) . "</{$typ}>"; |
|
289 | + $rs .= "<{$typ}>".base64_encode($val)."</{$typ}>"; |
|
290 | 290 | break; |
291 | 291 | case static::$xmlrpcBoolean: |
292 | - $rs .= "<{$typ}>" . ($val ? '1' : '0') . "</{$typ}>"; |
|
292 | + $rs .= "<{$typ}>".($val ? '1' : '0')."</{$typ}>"; |
|
293 | 293 | break; |
294 | 294 | case static::$xmlrpcString: |
295 | 295 | // Do NOT use htmlentities, since it will produce named html entities, which are invalid xml |
296 | - $rs .= "<{$typ}>" . $this->getCharsetEncoder()->encodeEntities($val, PhpXmlRpc::$xmlrpc_internalencoding, $charsetEncoding) . "</{$typ}>"; |
|
296 | + $rs .= "<{$typ}>".$this->getCharsetEncoder()->encodeEntities($val, PhpXmlRpc::$xmlrpc_internalencoding, $charsetEncoding)."</{$typ}>"; |
|
297 | 297 | break; |
298 | 298 | case static::$xmlrpcInt: |
299 | 299 | case static::$xmlrpcI4: |
300 | 300 | case static::$xmlrpcI8: |
301 | - $rs .= "<{$typ}>" . (int)$val . "</{$typ}>"; |
|
301 | + $rs .= "<{$typ}>".(int) $val."</{$typ}>"; |
|
302 | 302 | break; |
303 | 303 | case static::$xmlrpcDouble: |
304 | 304 | // avoid using standard conversion of float to string because it is locale-dependent, |
@@ -306,16 +306,16 @@ discard block |
||
306 | 306 | // sprintf('%F') could be most likely ok, but it fails e.g. on 2e-14. |
307 | 307 | // The code below tries its best at keeping max precision while avoiding exp notation, |
308 | 308 | // but there is of course no limit in the number of decimal places to be used... |
309 | - $rs .= "<{$typ}>" . preg_replace('/\\.?0+$/', '', number_format((double)$val, PhpXmlRpc::$xmlpc_double_precision, '.', '')) . "</{$typ}>"; |
|
309 | + $rs .= "<{$typ}>".preg_replace('/\\.?0+$/', '', number_format((double) $val, PhpXmlRpc::$xmlpc_double_precision, '.', ''))."</{$typ}>"; |
|
310 | 310 | break; |
311 | 311 | case static::$xmlrpcDateTime: |
312 | 312 | if (is_string($val)) { |
313 | 313 | $rs .= "<{$typ}>{$val}</{$typ}>"; |
314 | 314 | // DateTimeInterface is not present in php 5.4... |
315 | 315 | } elseif (is_a($val, 'DateTimeInterface') || is_a($val, 'DateTime')) { |
316 | - $rs .= "<{$typ}>" . $val->format('Ymd\TH:i:s') . "</{$typ}>"; |
|
316 | + $rs .= "<{$typ}>".$val->format('Ymd\TH:i:s')."</{$typ}>"; |
|
317 | 317 | } elseif (is_int($val)) { |
318 | - $rs .= "<{$typ}>" . date('Ymd\TH:i:s', $val) . "</{$typ}>"; |
|
318 | + $rs .= "<{$typ}>".date('Ymd\TH:i:s', $val)."</{$typ}>"; |
|
319 | 319 | } else { |
320 | 320 | // not really a good idea here: but what should we output anyway? left for backward compat... |
321 | 321 | $rs .= "<{$typ}>{$val}</{$typ}>"; |
@@ -337,14 +337,14 @@ discard block |
||
337 | 337 | case 3: |
338 | 338 | // struct |
339 | 339 | if ($this->_php_class) { |
340 | - $rs .= '<struct php_class="' . $this->_php_class . "\">\n"; |
|
340 | + $rs .= '<struct php_class="'.$this->_php_class."\">\n"; |
|
341 | 341 | } else { |
342 | 342 | $rs .= "<struct>\n"; |
343 | 343 | } |
344 | 344 | $charsetEncoder = $this->getCharsetEncoder(); |
345 | 345 | /** @var Value $val2 */ |
346 | 346 | foreach ($val as $key2 => $val2) { |
347 | - $rs .= '<member><name>' . $charsetEncoder->encodeEntities($key2, PhpXmlRpc::$xmlrpc_internalencoding, $charsetEncoding) . "</name>\n"; |
|
347 | + $rs .= '<member><name>'.$charsetEncoder->encodeEntities($key2, PhpXmlRpc::$xmlrpc_internalencoding, $charsetEncoding)."</name>\n"; |
|
348 | 348 | //$rs.=$this->serializeval($val2); |
349 | 349 | $rs .= $val2->serialize($charsetEncoding); |
350 | 350 | $rs .= "</member>\n"; |
@@ -379,7 +379,7 @@ discard block |
||
379 | 379 | $val = reset($this->me); |
380 | 380 | $typ = key($this->me); |
381 | 381 | |
382 | - return '<value>' . $this->serializedata($typ, $val, $charsetEncoding) . "</value>\n"; |
|
382 | + return '<value>'.$this->serializedata($typ, $val, $charsetEncoding)."</value>\n"; |
|
383 | 383 | } |
384 | 384 | |
385 | 385 | /** |