@@ -325,10 +325,10 @@ discard block |
||
| 325 | 325 | $server = $parts['host']; |
| 326 | 326 | $path = isset($parts['path']) ? $parts['path'] : ''; |
| 327 | 327 | if (isset($parts['query'])) { |
| 328 | - $path .= '?' . $parts['query']; |
|
| 328 | + $path .= '?'.$parts['query']; |
|
| 329 | 329 | } |
| 330 | 330 | if (isset($parts['fragment'])) { |
| 331 | - $path .= '#' . $parts['fragment']; |
|
| 331 | + $path .= '#'.$parts['fragment']; |
|
| 332 | 332 | } |
| 333 | 333 | if (isset($parts['port'])) { |
| 334 | 334 | $port = $parts['port']; |
@@ -344,7 +344,7 @@ discard block |
||
| 344 | 344 | } |
| 345 | 345 | } |
| 346 | 346 | if ($path == '' || $path[0] != '/') { |
| 347 | - $this->path = '/' . $path; |
|
| 347 | + $this->path = '/'.$path; |
|
| 348 | 348 | } else { |
| 349 | 349 | $this->path = $path; |
| 350 | 350 | } |
@@ -376,7 +376,7 @@ discard block |
||
| 376 | 376 | //$this->accepted_charset_encodings = $ch->knownCharsets(); |
| 377 | 377 | |
| 378 | 378 | // initialize user_agent string |
| 379 | - $this->user_agent = PhpXmlRpc::$xmlrpcName . ' ' . PhpXmlRpc::$xmlrpcVersion; |
|
| 379 | + $this->user_agent = PhpXmlRpc::$xmlrpcName.' '.PhpXmlRpc::$xmlrpcVersion; |
|
| 380 | 380 | } |
| 381 | 381 | |
| 382 | 382 | /** |
@@ -548,7 +548,7 @@ discard block |
||
| 548 | 548 | */ |
| 549 | 549 | public function setSSLVerifyPeer($i) |
| 550 | 550 | { |
| 551 | - $this->logDeprecation('Method ' . __METHOD__ . ' is deprecated'); |
|
| 551 | + $this->logDeprecation('Method '.__METHOD__.' is deprecated'); |
|
| 552 | 552 | |
| 553 | 553 | $this->verifypeer = $i; |
| 554 | 554 | return $this; |
@@ -565,7 +565,7 @@ discard block |
||
| 565 | 565 | */ |
| 566 | 566 | public function setSSLVerifyHost($i) |
| 567 | 567 | { |
| 568 | - $this->logDeprecation('Method ' . __METHOD__ . ' is deprecated'); |
|
| 568 | + $this->logDeprecation('Method '.__METHOD__.' is deprecated'); |
|
| 569 | 569 | |
| 570 | 570 | $this->verifyhost = $i; |
| 571 | 571 | return $this; |
@@ -580,7 +580,7 @@ discard block |
||
| 580 | 580 | */ |
| 581 | 581 | public function setSSLVersion($i) |
| 582 | 582 | { |
| 583 | - $this->logDeprecation('Method ' . __METHOD__ . ' is deprecated'); |
|
| 583 | + $this->logDeprecation('Method '.__METHOD__.' is deprecated'); |
|
| 584 | 584 | |
| 585 | 585 | $this->sslversion = $i; |
| 586 | 586 | return $this; |
@@ -645,7 +645,7 @@ discard block |
||
| 645 | 645 | */ |
| 646 | 646 | public function setRequestCompression($compMethod) |
| 647 | 647 | { |
| 648 | - $this->logDeprecation('Method ' . __METHOD__ . ' is deprecated'); |
|
| 648 | + $this->logDeprecation('Method '.__METHOD__.' is deprecated'); |
|
| 649 | 649 | |
| 650 | 650 | $this->request_compression = $compMethod; |
| 651 | 651 | return $this; |
@@ -695,7 +695,7 @@ discard block |
||
| 695 | 695 | */ |
| 696 | 696 | public function setCurlOptions($options) |
| 697 | 697 | { |
| 698 | - $this->logDeprecation('Method ' . __METHOD__ . ' is deprecated'); |
|
| 698 | + $this->logDeprecation('Method '.__METHOD__.' is deprecated'); |
|
| 699 | 699 | |
| 700 | 700 | $this->extracurlopts = $options; |
| 701 | 701 | return $this; |
@@ -708,7 +708,7 @@ discard block |
||
| 708 | 708 | */ |
| 709 | 709 | public function setUseCurl($useCurlMode) |
| 710 | 710 | { |
| 711 | - $this->logDeprecation('Method ' . __METHOD__ . ' is deprecated'); |
|
| 711 | + $this->logDeprecation('Method '.__METHOD__.' is deprecated'); |
|
| 712 | 712 | |
| 713 | 713 | $this->use_curl = $useCurlMode; |
| 714 | 714 | return $this; |
@@ -726,7 +726,7 @@ discard block |
||
| 726 | 726 | */ |
| 727 | 727 | public function setUserAgent($agentString) |
| 728 | 728 | { |
| 729 | - $this->logDeprecation('Method ' . __METHOD__ . ' is deprecated'); |
|
| 729 | + $this->logDeprecation('Method '.__METHOD__.' is deprecated'); |
|
| 730 | 730 | |
| 731 | 731 | $this->user_agent = $agentString; |
| 732 | 732 | return $this; |
@@ -757,12 +757,12 @@ discard block |
||
| 757 | 757 | } |
| 758 | 758 | } |
| 759 | 759 | |
| 760 | - $url = $this->method . '://' . $this->server; |
|
| 760 | + $url = $this->method.'://'.$this->server; |
|
| 761 | 761 | if ($this->port == 0 || ($this->port == 80 && in_array($this->method, array('http', 'http10', 'http11', 'h2c'))) || |
| 762 | 762 | ($this->port == 443 && in_array($this->method, array('https', 'h2')))) { |
| 763 | - return $url . $this->path; |
|
| 763 | + return $url.$this->path; |
|
| 764 | 764 | } else { |
| 765 | - return $url . ':' . $this->port . $this->path; |
|
| 765 | + return $url.':'.$this->port.$this->path; |
|
| 766 | 766 | } |
| 767 | 767 | } |
| 768 | 768 | |
@@ -802,7 +802,7 @@ discard block |
||
| 802 | 802 | public function send($req, $timeout = 0, $method = '') |
| 803 | 803 | { |
| 804 | 804 | if ($method !== '' || $timeout !== 0) { |
| 805 | - $this->logDeprecation("Using non-default values for arguments 'method' and 'timeout' when calling method " . __METHOD__ . ' is deprecated'); |
|
| 805 | + $this->logDeprecation("Using non-default values for arguments 'method' and 'timeout' when calling method ".__METHOD__.' is deprecated'); |
|
| 806 | 806 | } |
| 807 | 807 | |
| 808 | 808 | // if user does not specify http protocol, use native method of this client |
@@ -917,7 +917,7 @@ discard block |
||
| 917 | 917 | $payload = $a; |
| 918 | 918 | $encodingHdr = "Content-Encoding: gzip\r\n"; |
| 919 | 919 | } else { |
| 920 | - $this->getLogger()->warning('XML-RPC: ' . __METHOD__ . ': gzencode failure in compressing request'); |
|
| 920 | + $this->getLogger()->warning('XML-RPC: '.__METHOD__.': gzencode failure in compressing request'); |
|
| 921 | 921 | } |
| 922 | 922 | } else if (function_exists('gzcompress')) { |
| 923 | 923 | $a = @gzcompress($payload); |
@@ -925,29 +925,29 @@ discard block |
||
| 925 | 925 | $payload = $a; |
| 926 | 926 | $encodingHdr = "Content-Encoding: deflate\r\n"; |
| 927 | 927 | } else { |
| 928 | - $this->getLogger()->warning('XML-RPC: ' . __METHOD__ . ': gzcompress failure in compressing request'); |
|
| 928 | + $this->getLogger()->warning('XML-RPC: '.__METHOD__.': gzcompress failure in compressing request'); |
|
| 929 | 929 | } |
| 930 | 930 | } else { |
| 931 | - $this->getLogger()->warning('XML-RPC: ' . __METHOD__ . ': desired request compression method is unsupported by this PHP install'); |
|
| 931 | + $this->getLogger()->warning('XML-RPC: '.__METHOD__.': desired request compression method is unsupported by this PHP install'); |
|
| 932 | 932 | } |
| 933 | 933 | } else { |
| 934 | - $this->getLogger()->warning('XML-RPC: ' . __METHOD__ . ': desired request compression method is unsupported'); |
|
| 934 | + $this->getLogger()->warning('XML-RPC: '.__METHOD__.': desired request compression method is unsupported'); |
|
| 935 | 935 | } |
| 936 | 936 | |
| 937 | 937 | // thanks to Grant Rauscher |
| 938 | 938 | $credentials = ''; |
| 939 | 939 | if ($opts['username'] != '') { |
| 940 | - $credentials = 'Authorization: Basic ' . base64_encode($opts['username'] . ':' . $opts['password']) . "\r\n"; |
|
| 940 | + $credentials = 'Authorization: Basic '.base64_encode($opts['username'].':'.$opts['password'])."\r\n"; |
|
| 941 | 941 | if ($opts['authtype'] != 1) { |
| 942 | - $this->getLogger()->error('XML-RPC: ' . __METHOD__ . ': warning. Only Basic auth is supported with HTTP 1.0'); |
|
| 942 | + $this->getLogger()->error('XML-RPC: '.__METHOD__.': warning. Only Basic auth is supported with HTTP 1.0'); |
|
| 943 | 943 | return new static::$responseClass(0, PhpXmlRpc::$xmlrpcerr['unsupported_option'], |
| 944 | - PhpXmlRpc::$xmlrpcerr['unsupported_option'] . ': only Basic auth is supported with HTTP 1.0'); |
|
| 944 | + PhpXmlRpc::$xmlrpcerr['unsupported_option'].': only Basic auth is supported with HTTP 1.0'); |
|
| 945 | 945 | } |
| 946 | 946 | } |
| 947 | 947 | |
| 948 | 948 | $acceptedEncoding = ''; |
| 949 | 949 | if (is_array($opts['accepted_compression']) && count($opts['accepted_compression'])) { |
| 950 | - $acceptedEncoding = 'Accept-Encoding: ' . implode(', ', $opts['accepted_compression']) . "\r\n"; |
|
| 950 | + $acceptedEncoding = 'Accept-Encoding: '.implode(', ', $opts['accepted_compression'])."\r\n"; |
|
| 951 | 951 | } |
| 952 | 952 | |
| 953 | 953 | if ($port == 0) { |
@@ -963,15 +963,15 @@ discard block |
||
| 963 | 963 | $connectPort = $opts['proxyport']; |
| 964 | 964 | $transport = 'tcp'; |
| 965 | 965 | /// @todo check: should we not use https in some cases? |
| 966 | - $uri = 'http://' . $server . ':' . $port . $path; |
|
| 966 | + $uri = 'http://'.$server.':'.$port.$path; |
|
| 967 | 967 | if ($opts['proxy_user'] != '') { |
| 968 | 968 | if ($opts['proxy_authtype'] != 1) { |
| 969 | - $this->getLogger()->error('XML-RPC: ' . __METHOD__ . ': warning. Only Basic auth to proxy is supported with HTTP 1.0'); |
|
| 969 | + $this->getLogger()->error('XML-RPC: '.__METHOD__.': warning. Only Basic auth to proxy is supported with HTTP 1.0'); |
|
| 970 | 970 | return new static::$responseClass(0, PhpXmlRpc::$xmlrpcerr['unsupported_option'], |
| 971 | - PhpXmlRpc::$xmlrpcerr['unsupported_option'] . ': only Basic auth to proxy is supported with HTTP 1.0'); |
|
| 971 | + PhpXmlRpc::$xmlrpcerr['unsupported_option'].': only Basic auth to proxy is supported with HTTP 1.0'); |
|
| 972 | 972 | } |
| 973 | - $proxyCredentials = 'Proxy-Authorization: Basic ' . base64_encode($opts['proxy_user'] . ':' . |
|
| 974 | - $opts['proxy_pass']) . "\r\n"; |
|
| 973 | + $proxyCredentials = 'Proxy-Authorization: Basic '.base64_encode($opts['proxy_user'].':'. |
|
| 974 | + $opts['proxy_pass'])."\r\n"; |
|
| 975 | 975 | } |
| 976 | 976 | } else { |
| 977 | 977 | $connectServer = $server; |
@@ -987,32 +987,32 @@ discard block |
||
| 987 | 987 | $version = ''; |
| 988 | 988 | foreach ($opts['cookies'] as $name => $cookie) { |
| 989 | 989 | /// @todo should we sanitize the cookie value on behalf of the user? See setCookie comments |
| 990 | - $cookieHeader .= ' ' . $name . '=' . $cookie['value'] . ";"; |
|
| 990 | + $cookieHeader .= ' '.$name.'='.$cookie['value'].";"; |
|
| 991 | 991 | } |
| 992 | - $cookieHeader = 'Cookie:' . $version . substr($cookieHeader, 0, -1) . "\r\n"; |
|
| 992 | + $cookieHeader = 'Cookie:'.$version.substr($cookieHeader, 0, -1)."\r\n"; |
|
| 993 | 993 | } |
| 994 | 994 | |
| 995 | 995 | // omit port if default |
| 996 | 996 | if (($port == 80 && in_array($method, array('http', 'http10'))) || ($port == 443 && $method == 'https')) { |
| 997 | 997 | $port = ''; |
| 998 | 998 | } else { |
| 999 | - $port = ':' . $port; |
|
| 1000 | - } |
|
| 1001 | - |
|
| 1002 | - $op = 'POST ' . $uri . " HTTP/1.0\r\n" . |
|
| 1003 | - 'User-Agent: ' . $opts['user_agent'] . "\r\n" . |
|
| 1004 | - 'Host: ' . $server . $port . "\r\n" . |
|
| 1005 | - $credentials . |
|
| 1006 | - $proxyCredentials . |
|
| 1007 | - $acceptedEncoding . |
|
| 1008 | - $encodingHdr . |
|
| 1009 | - 'Accept-Charset: ' . implode(',', $opts['accepted_charset_encodings']) . "\r\n" . |
|
| 1010 | - $cookieHeader . |
|
| 1011 | - 'Content-Type: ' . $req->getContentType() . "\r\nContent-Length: " . |
|
| 1012 | - strlen($payload) . "\r\n\r\n" . |
|
| 999 | + $port = ':'.$port; |
|
| 1000 | + } |
|
| 1001 | + |
|
| 1002 | + $op = 'POST '.$uri." HTTP/1.0\r\n". |
|
| 1003 | + 'User-Agent: '.$opts['user_agent']."\r\n". |
|
| 1004 | + 'Host: '.$server.$port."\r\n". |
|
| 1005 | + $credentials. |
|
| 1006 | + $proxyCredentials. |
|
| 1007 | + $acceptedEncoding. |
|
| 1008 | + $encodingHdr. |
|
| 1009 | + 'Accept-Charset: '.implode(',', $opts['accepted_charset_encodings'])."\r\n". |
|
| 1010 | + $cookieHeader. |
|
| 1011 | + 'Content-Type: '.$req->getContentType()."\r\nContent-Length: ". |
|
| 1012 | + strlen($payload)."\r\n\r\n". |
|
| 1013 | 1013 | $payload; |
| 1014 | 1014 | |
| 1015 | - if ($opts['debug'] > 1) { |
|
| 1015 | + if ($opts['debug']>1) { |
|
| 1016 | 1016 | $this->getLogger()->debug("---SENDING---\n$op\n---END---"); |
| 1017 | 1017 | } |
| 1018 | 1018 | |
@@ -1045,7 +1045,7 @@ discard block |
||
| 1045 | 1045 | |
| 1046 | 1046 | $context = stream_context_create($contextOptions); |
| 1047 | 1047 | |
| 1048 | - if ($opts['timeout'] <= 0) { |
|
| 1048 | + if ($opts['timeout']<=0) { |
|
| 1049 | 1049 | $connectTimeout = ini_get('default_socket_timeout'); |
| 1050 | 1050 | } else { |
| 1051 | 1051 | $connectTimeout = $opts['timeout']; |
@@ -1057,7 +1057,7 @@ discard block |
||
| 1057 | 1057 | $fp = @stream_socket_client("$transport://$connectServer:$connectPort", $this->errno, $this->errstr, $connectTimeout, |
| 1058 | 1058 | STREAM_CLIENT_CONNECT, $context); |
| 1059 | 1059 | if ($fp) { |
| 1060 | - if ($opts['timeout'] > 0) { |
|
| 1060 | + if ($opts['timeout']>0) { |
|
| 1061 | 1061 | stream_set_timeout($fp, $opts['timeout'], 0); |
| 1062 | 1062 | } |
| 1063 | 1063 | } else { |
@@ -1066,8 +1066,8 @@ discard block |
||
| 1066 | 1066 | $this->errstr = $err['message']; |
| 1067 | 1067 | } |
| 1068 | 1068 | |
| 1069 | - $this->errstr = 'Connect error: ' . $this->errstr; |
|
| 1070 | - $r = new static::$responseClass(0, PhpXmlRpc::$xmlrpcerr['http_error'], $this->errstr . ' (' . $this->errno . ')'); |
|
| 1069 | + $this->errstr = 'Connect error: '.$this->errstr; |
|
| 1070 | + $r = new static::$responseClass(0, PhpXmlRpc::$xmlrpcerr['http_error'], $this->errstr.' ('.$this->errno.')'); |
|
| 1071 | 1071 | |
| 1072 | 1072 | return $r; |
| 1073 | 1073 | } |
@@ -1134,19 +1134,19 @@ discard block |
||
| 1134 | 1134 | $opts['keepalive'], $opts['key'], $opts['keypass'], $opts['sslversion']); |
| 1135 | 1135 | |
| 1136 | 1136 | if (!$curl) { |
| 1137 | - return new static::$responseClass(0, PhpXmlRpc::$xmlrpcerr['curl_fail'], PhpXmlRpc::$xmlrpcstr['curl_fail'] . |
|
| 1137 | + return new static::$responseClass(0, PhpXmlRpc::$xmlrpcerr['curl_fail'], PhpXmlRpc::$xmlrpcstr['curl_fail']. |
|
| 1138 | 1138 | ': error during curl initialization. Check php error log for details'); |
| 1139 | 1139 | } |
| 1140 | 1140 | |
| 1141 | 1141 | $result = curl_exec($curl); |
| 1142 | 1142 | |
| 1143 | - if ($opts['debug'] > 1) { |
|
| 1143 | + if ($opts['debug']>1) { |
|
| 1144 | 1144 | $message = "---CURL INFO---\n"; |
| 1145 | 1145 | foreach (curl_getinfo($curl) as $name => $val) { |
| 1146 | 1146 | if (is_array($val)) { |
| 1147 | 1147 | $val = implode("\n", $val); |
| 1148 | 1148 | } |
| 1149 | - $message .= $name . ': ' . $val . "\n"; |
|
| 1149 | + $message .= $name.': '.$val."\n"; |
|
| 1150 | 1150 | } |
| 1151 | 1151 | $message .= '---END---'; |
| 1152 | 1152 | $this->getLogger()->debug($message); |
@@ -1156,8 +1156,8 @@ discard block |
||
| 1156 | 1156 | /// @todo we should use a better check here - what if we get back '' or '0'? |
| 1157 | 1157 | |
| 1158 | 1158 | $this->errstr = 'no response'; |
| 1159 | - $resp = new static::$responseClass(0, PhpXmlRpc::$xmlrpcerr['curl_fail'], PhpXmlRpc::$xmlrpcstr['curl_fail'] . |
|
| 1160 | - ': ' . curl_error($curl)); |
|
| 1159 | + $resp = new static::$responseClass(0, PhpXmlRpc::$xmlrpcerr['curl_fail'], PhpXmlRpc::$xmlrpcstr['curl_fail']. |
|
| 1160 | + ': '.curl_error($curl)); |
|
| 1161 | 1161 | curl_close($curl); |
| 1162 | 1162 | if ($opts['keepalive']) { |
| 1163 | 1163 | $this->xmlrpc_curl_handle = null; |
@@ -1215,7 +1215,7 @@ discard block |
||
| 1215 | 1215 | $payload = $a; |
| 1216 | 1216 | $encodingHdr = 'Content-Encoding: gzip'; |
| 1217 | 1217 | } else { |
| 1218 | - $this->getLogger()->warning('XML-RPC: ' . __METHOD__ . ': gzencode failure in compressing request'); |
|
| 1218 | + $this->getLogger()->warning('XML-RPC: '.__METHOD__.': gzencode failure in compressing request'); |
|
| 1219 | 1219 | } |
| 1220 | 1220 | } else if (function_exists('gzcompress')) { |
| 1221 | 1221 | $a = @gzcompress($payload); |
@@ -1223,13 +1223,13 @@ discard block |
||
| 1223 | 1223 | $payload = $a; |
| 1224 | 1224 | $encodingHdr = 'Content-Encoding: deflate'; |
| 1225 | 1225 | } else { |
| 1226 | - $this->getLogger()->warning('XML-RPC: ' . __METHOD__ . ': gzcompress failure in compressing request'); |
|
| 1226 | + $this->getLogger()->warning('XML-RPC: '.__METHOD__.': gzcompress failure in compressing request'); |
|
| 1227 | 1227 | } |
| 1228 | 1228 | } else { |
| 1229 | - $this->getLogger()->warning('XML-RPC: ' . __METHOD__ . ': desired request compression method is unsupported by this PHP install'); |
|
| 1229 | + $this->getLogger()->warning('XML-RPC: '.__METHOD__.': desired request compression method is unsupported by this PHP install'); |
|
| 1230 | 1230 | } |
| 1231 | 1231 | } else { |
| 1232 | - $this->getLogger()->warning('XML-RPC: ' . __METHOD__ . ': desired request compression method is unsupported'); |
|
| 1232 | + $this->getLogger()->warning('XML-RPC: '.__METHOD__.': desired request compression method is unsupported'); |
|
| 1233 | 1233 | } |
| 1234 | 1234 | |
| 1235 | 1235 | if (!$opts['keepalive'] || !$this->xmlrpc_curl_handle) { |
@@ -1242,12 +1242,12 @@ discard block |
||
| 1242 | 1242 | // http, https |
| 1243 | 1243 | $protocol = $method; |
| 1244 | 1244 | if (strpos($protocol, ':') !== false) { |
| 1245 | - $this->getLogger()->error('XML-RPC: ' . __METHOD__ . ": warning - attempted hacking attempt?. The curl protocol requested for the call is: '$protocol'"); |
|
| 1245 | + $this->getLogger()->error('XML-RPC: '.__METHOD__.": warning - attempted hacking attempt?. The curl protocol requested for the call is: '$protocol'"); |
|
| 1246 | 1246 | return false; |
| 1247 | 1247 | } |
| 1248 | 1248 | } |
| 1249 | 1249 | } |
| 1250 | - $curl = curl_init($protocol . '://' . $server . ':' . $port . $path); |
|
| 1250 | + $curl = curl_init($protocol.'://'.$server.':'.$port.$path); |
|
| 1251 | 1251 | if (!$curl) { |
| 1252 | 1252 | return false; |
| 1253 | 1253 | } |
@@ -1261,7 +1261,7 @@ discard block |
||
| 1261 | 1261 | // results into variable |
| 1262 | 1262 | curl_setopt($curl, CURLOPT_RETURNTRANSFER, true); |
| 1263 | 1263 | |
| 1264 | - if ($opts['debug'] > 1) { |
|
| 1264 | + if ($opts['debug']>1) { |
|
| 1265 | 1265 | curl_setopt($curl, CURLOPT_VERBOSE, true); |
| 1266 | 1266 | /// @todo redirect curlopt_stderr to some stream which can be piped to the logger |
| 1267 | 1267 | } |
@@ -1286,7 +1286,7 @@ discard block |
||
| 1286 | 1286 | } |
| 1287 | 1287 | } |
| 1288 | 1288 | // extra headers |
| 1289 | - $headers = array('Content-Type: ' . $req->getContentType(), 'Accept-Charset: ' . implode(',', $opts['accepted_charset_encodings'])); |
|
| 1289 | + $headers = array('Content-Type: '.$req->getContentType(), 'Accept-Charset: '.implode(',', $opts['accepted_charset_encodings'])); |
|
| 1290 | 1290 | // if no keepalive is wanted, let the server know it in advance |
| 1291 | 1291 | if (!$opts['keepalive']) { |
| 1292 | 1292 | $headers[] = 'Connection: close'; |
@@ -1303,7 +1303,7 @@ discard block |
||
| 1303 | 1303 | curl_setopt($curl, CURLOPT_HTTPHEADER, $headers); |
| 1304 | 1304 | // timeout is borked |
| 1305 | 1305 | if ($opts['timeout']) { |
| 1306 | - curl_setopt($curl, CURLOPT_TIMEOUT, $opts['timeout'] == 1 ? 1 : $opts['timeout'] - 1); |
|
| 1306 | + curl_setopt($curl, CURLOPT_TIMEOUT, $opts['timeout'] == 1 ? 1 : $opts['timeout']-1); |
|
| 1307 | 1307 | } |
| 1308 | 1308 | |
| 1309 | 1309 | switch ($method) { |
@@ -1317,7 +1317,7 @@ discard block |
||
| 1317 | 1317 | if (defined('CURL_HTTP_VERSION_2_PRIOR_KNOWLEDGE')) { |
| 1318 | 1318 | curl_setopt($curl, CURLOPT_HTTP_VERSION, CURL_HTTP_VERSION_2_PRIOR_KNOWLEDGE); |
| 1319 | 1319 | } else { |
| 1320 | - $this->getLogger()->error('XML-RPC: ' . __METHOD__ . ': warning. HTTP2 is not supported by the current PHP/curl install'); |
|
| 1320 | + $this->getLogger()->error('XML-RPC: '.__METHOD__.': warning. HTTP2 is not supported by the current PHP/curl install'); |
|
| 1321 | 1321 | curl_close($curl); |
| 1322 | 1322 | return false; |
| 1323 | 1323 | } |
@@ -1328,11 +1328,11 @@ discard block |
||
| 1328 | 1328 | } |
| 1329 | 1329 | |
| 1330 | 1330 | if ($opts['username'] && $opts['password']) { |
| 1331 | - curl_setopt($curl, CURLOPT_USERPWD, $opts['username'] . ':' . $opts['password']); |
|
| 1331 | + curl_setopt($curl, CURLOPT_USERPWD, $opts['username'].':'.$opts['password']); |
|
| 1332 | 1332 | if (defined('CURLOPT_HTTPAUTH')) { |
| 1333 | 1333 | curl_setopt($curl, CURLOPT_HTTPAUTH, $opts['authtype']); |
| 1334 | 1334 | } elseif ($opts['authtype'] != 1) { |
| 1335 | - $this->getLogger()->error('XML-RPC: ' . __METHOD__ . ': warning. Only Basic auth is supported by the current PHP/curl install'); |
|
| 1335 | + $this->getLogger()->error('XML-RPC: '.__METHOD__.': warning. Only Basic auth is supported by the current PHP/curl install'); |
|
| 1336 | 1336 | curl_close($curl); |
| 1337 | 1337 | return false; |
| 1338 | 1338 | } |
@@ -1377,13 +1377,13 @@ discard block |
||
| 1377 | 1377 | if ($opts['proxyport'] == 0) { |
| 1378 | 1378 | $opts['proxyport'] = 8080; // NB: even for HTTPS, local connection is on port 8080 |
| 1379 | 1379 | } |
| 1380 | - curl_setopt($curl, CURLOPT_PROXY, $opts['proxy'] . ':' . $opts['proxyport']); |
|
| 1380 | + curl_setopt($curl, CURLOPT_PROXY, $opts['proxy'].':'.$opts['proxyport']); |
|
| 1381 | 1381 | if ($opts['proxy_user']) { |
| 1382 | - curl_setopt($curl, CURLOPT_PROXYUSERPWD, $opts['proxy_user'] . ':' . $opts['proxy_pass']); |
|
| 1382 | + curl_setopt($curl, CURLOPT_PROXYUSERPWD, $opts['proxy_user'].':'.$opts['proxy_pass']); |
|
| 1383 | 1383 | if (defined('CURLOPT_PROXYAUTH')) { |
| 1384 | 1384 | curl_setopt($curl, CURLOPT_PROXYAUTH, $opts['proxy_authtype']); |
| 1385 | 1385 | } elseif ($opts['proxy_authtype'] != 1) { |
| 1386 | - $this->getLogger()->error('XML-RPC: ' . __METHOD__ . ': warning. Only Basic auth to proxy is supported by the current PHP/curl install'); |
|
| 1386 | + $this->getLogger()->error('XML-RPC: '.__METHOD__.': warning. Only Basic auth to proxy is supported by the current PHP/curl install'); |
|
| 1387 | 1387 | curl_close($curl); |
| 1388 | 1388 | return false; |
| 1389 | 1389 | } |
@@ -1395,7 +1395,7 @@ discard block |
||
| 1395 | 1395 | if (count($opts['cookies'])) { |
| 1396 | 1396 | $cookieHeader = ''; |
| 1397 | 1397 | foreach ($opts['cookies'] as $name => $cookie) { |
| 1398 | - $cookieHeader .= $name . '=' . $cookie['value'] . '; '; |
|
| 1398 | + $cookieHeader .= $name.'='.$cookie['value'].'; '; |
|
| 1399 | 1399 | } |
| 1400 | 1400 | curl_setopt($curl, CURLOPT_COOKIE, substr($cookieHeader, 0, -2)); |
| 1401 | 1401 | } |
@@ -1404,7 +1404,7 @@ discard block |
||
| 1404 | 1404 | curl_setopt($curl, $opt, $val); |
| 1405 | 1405 | } |
| 1406 | 1406 | |
| 1407 | - if ($opts['debug'] > 1) { |
|
| 1407 | + if ($opts['debug']>1) { |
|
| 1408 | 1408 | $this->getLogger()->debug("---SENDING---\n$payload\n---END---"); |
| 1409 | 1409 | } |
| 1410 | 1410 | |
@@ -1505,7 +1505,7 @@ discard block |
||
| 1505 | 1505 | $call['methodName'] = new Value($req->method(), 'string'); |
| 1506 | 1506 | $numParams = $req->getNumParams(); |
| 1507 | 1507 | $params = array(); |
| 1508 | - for ($i = 0; $i < $numParams; $i++) { |
|
| 1508 | + for ($i = 0; $i<$numParams; $i++) { |
|
| 1509 | 1509 | $params[$i] = $req->getParam($i); |
| 1510 | 1510 | } |
| 1511 | 1511 | $call['params'] = new Value($params, 'array'); |
@@ -1527,7 +1527,7 @@ discard block |
||
| 1527 | 1527 | $response = array(); |
| 1528 | 1528 | |
| 1529 | 1529 | if ($this->return_type == 'xml') { |
| 1530 | - for ($i = 0; $i < count($reqs); $i++) { |
|
| 1530 | + for ($i = 0; $i<count($reqs); $i++) { |
|
| 1531 | 1531 | $response[] = new Response($rets, 0, '', 'xml', $result->httpResponse()); |
| 1532 | 1532 | } |
| 1533 | 1533 | |
@@ -1535,21 +1535,21 @@ discard block |
||
| 1535 | 1535 | if (!is_array($rets)) { |
| 1536 | 1536 | // bad return type from system.multicall |
| 1537 | 1537 | return new Response(0, PhpXmlRpc::$xmlrpcerr['multicall_error'], |
| 1538 | - PhpXmlRpc::$xmlrpcstr['multicall_error'] . ': not an array', 'phpvals', $result->httpResponse()); |
|
| 1538 | + PhpXmlRpc::$xmlrpcstr['multicall_error'].': not an array', 'phpvals', $result->httpResponse()); |
|
| 1539 | 1539 | } |
| 1540 | 1540 | $numRets = count($rets); |
| 1541 | 1541 | if ($numRets != count($reqs)) { |
| 1542 | 1542 | // wrong number of return values. |
| 1543 | 1543 | return new Response(0, PhpXmlRpc::$xmlrpcerr['multicall_error'], |
| 1544 | - PhpXmlRpc::$xmlrpcstr['multicall_error'] . ': incorrect number of responses', 'phpvals', |
|
| 1544 | + PhpXmlRpc::$xmlrpcstr['multicall_error'].': incorrect number of responses', 'phpvals', |
|
| 1545 | 1545 | $result->httpResponse()); |
| 1546 | 1546 | } |
| 1547 | 1547 | |
| 1548 | - for ($i = 0; $i < $numRets; $i++) { |
|
| 1548 | + for ($i = 0; $i<$numRets; $i++) { |
|
| 1549 | 1549 | $val = $rets[$i]; |
| 1550 | 1550 | if (!is_array($val)) { |
| 1551 | 1551 | return new Response(0, PhpXmlRpc::$xmlrpcerr['multicall_error'], |
| 1552 | - PhpXmlRpc::$xmlrpcstr['multicall_error'] . ": response element $i is not an array or struct", |
|
| 1552 | + PhpXmlRpc::$xmlrpcstr['multicall_error'].": response element $i is not an array or struct", |
|
| 1553 | 1553 | 'phpvals', $result->httpResponse()); |
| 1554 | 1554 | } |
| 1555 | 1555 | switch (count($val)) { |
@@ -1557,7 +1557,7 @@ discard block |
||
| 1557 | 1557 | if (!isset($val[0])) { |
| 1558 | 1558 | // Bad value |
| 1559 | 1559 | return new Response(0, PhpXmlRpc::$xmlrpcerr['multicall_error'], |
| 1560 | - PhpXmlRpc::$xmlrpcstr['multicall_error'] . ": response element $i has no value", |
|
| 1560 | + PhpXmlRpc::$xmlrpcstr['multicall_error'].": response element $i has no value", |
|
| 1561 | 1561 | 'phpvals', $result->httpResponse()); |
| 1562 | 1562 | } |
| 1563 | 1563 | // Normal return value |
@@ -1569,20 +1569,20 @@ discard block |
||
| 1569 | 1569 | if (!is_int($code)) { |
| 1570 | 1570 | /// @todo should we check that it is != 0? |
| 1571 | 1571 | return new Response(0, PhpXmlRpc::$xmlrpcerr['multicall_error'], |
| 1572 | - PhpXmlRpc::$xmlrpcstr['multicall_error'] . ": response element $i has invalid or no faultCode", |
|
| 1572 | + PhpXmlRpc::$xmlrpcstr['multicall_error'].": response element $i has invalid or no faultCode", |
|
| 1573 | 1573 | 'phpvals', $result->httpResponse()); |
| 1574 | 1574 | } |
| 1575 | 1575 | $str = @$val['faultString']; |
| 1576 | 1576 | if (!is_string($str)) { |
| 1577 | 1577 | return new Response(0, PhpXmlRpc::$xmlrpcerr['multicall_error'], |
| 1578 | - PhpXmlRpc::$xmlrpcstr['multicall_error'] . ": response element $i has invalid or no FaultString", |
|
| 1578 | + PhpXmlRpc::$xmlrpcstr['multicall_error'].": response element $i has invalid or no FaultString", |
|
| 1579 | 1579 | 'phpvals', $result->httpResponse()); |
| 1580 | 1580 | } |
| 1581 | 1581 | $response[$i] = new Response(0, $code, $str, 'phpvals', $result->httpResponse()); |
| 1582 | 1582 | break; |
| 1583 | 1583 | default: |
| 1584 | 1584 | return new Response(0, PhpXmlRpc::$xmlrpcerr['multicall_error'], |
| 1585 | - PhpXmlRpc::$xmlrpcstr['multicall_error'] . ": response element $i has too many items", |
|
| 1585 | + PhpXmlRpc::$xmlrpcstr['multicall_error'].": response element $i has too many items", |
|
| 1586 | 1586 | 'phpvals', $result->httpResponse()); |
| 1587 | 1587 | } |
| 1588 | 1588 | } |
@@ -1591,14 +1591,14 @@ discard block |
||
| 1591 | 1591 | // return type == 'xmlrpcvals' |
| 1592 | 1592 | if ($rets->kindOf() != 'array') { |
| 1593 | 1593 | return new Response(0, PhpXmlRpc::$xmlrpcerr['multicall_error'], |
| 1594 | - PhpXmlRpc::$xmlrpcstr['multicall_error'] . ": response element $i is not an array", 'xmlrpcvals', |
|
| 1594 | + PhpXmlRpc::$xmlrpcstr['multicall_error'].": response element $i is not an array", 'xmlrpcvals', |
|
| 1595 | 1595 | $result->httpResponse()); |
| 1596 | 1596 | } |
| 1597 | 1597 | $numRets = $rets->count(); |
| 1598 | 1598 | if ($numRets != count($reqs)) { |
| 1599 | 1599 | // wrong number of return values. |
| 1600 | 1600 | return new Response(0, PhpXmlRpc::$xmlrpcerr['multicall_error'], |
| 1601 | - PhpXmlRpc::$xmlrpcstr['multicall_error'] . ': incorrect number of responses', 'xmlrpcvals', |
|
| 1601 | + PhpXmlRpc::$xmlrpcstr['multicall_error'].': incorrect number of responses', 'xmlrpcvals', |
|
| 1602 | 1602 | $result->httpResponse()); |
| 1603 | 1603 | } |
| 1604 | 1604 | |
@@ -1607,7 +1607,7 @@ discard block |
||
| 1607 | 1607 | case 'array': |
| 1608 | 1608 | if ($val->count() != 1) { |
| 1609 | 1609 | return new Response(0, PhpXmlRpc::$xmlrpcerr['multicall_error'], |
| 1610 | - PhpXmlRpc::$xmlrpcstr['multicall_error'] . ": response element $i has too many items", |
|
| 1610 | + PhpXmlRpc::$xmlrpcstr['multicall_error'].": response element $i has too many items", |
|
| 1611 | 1611 | 'phpvals', $result->httpResponse()); |
| 1612 | 1612 | } |
| 1613 | 1613 | // Normal return value |
@@ -1616,28 +1616,28 @@ discard block |
||
| 1616 | 1616 | case 'struct': |
| 1617 | 1617 | if ($val->count() != 2) { |
| 1618 | 1618 | return new Response(0, PhpXmlRpc::$xmlrpcerr['multicall_error'], |
| 1619 | - PhpXmlRpc::$xmlrpcstr['multicall_error'] . ": response element $i has too many items", |
|
| 1619 | + PhpXmlRpc::$xmlrpcstr['multicall_error'].": response element $i has too many items", |
|
| 1620 | 1620 | 'phpvals', $result->httpResponse()); |
| 1621 | 1621 | } |
| 1622 | 1622 | /** @var Value $code */ |
| 1623 | 1623 | $code = $val['faultCode']; |
| 1624 | 1624 | if ($code->kindOf() != 'scalar' || $code->scalarTyp() != 'int') { |
| 1625 | 1625 | return new Response(0, PhpXmlRpc::$xmlrpcerr['multicall_error'], |
| 1626 | - PhpXmlRpc::$xmlrpcstr['multicall_error'] . ": response element $i has invalid or no faultCode", |
|
| 1626 | + PhpXmlRpc::$xmlrpcstr['multicall_error'].": response element $i has invalid or no faultCode", |
|
| 1627 | 1627 | 'xmlrpcvals', $result->httpResponse()); |
| 1628 | 1628 | } |
| 1629 | 1629 | /** @var Value $str */ |
| 1630 | 1630 | $str = $val['faultString']; |
| 1631 | 1631 | if ($str->kindOf() != 'scalar' || $str->scalarTyp() != 'string') { |
| 1632 | 1632 | return new Response(0, PhpXmlRpc::$xmlrpcerr['multicall_error'], |
| 1633 | - PhpXmlRpc::$xmlrpcstr['multicall_error'] . ": response element $i has invalid or no faultCode", |
|
| 1633 | + PhpXmlRpc::$xmlrpcstr['multicall_error'].": response element $i has invalid or no faultCode", |
|
| 1634 | 1634 | 'xmlrpcvals', $result->httpResponse()); |
| 1635 | 1635 | } |
| 1636 | 1636 | $response[] = new Response(0, $code->scalarVal(), $str->scalarVal(), 'xmlrpcvals', $result->httpResponse()); |
| 1637 | 1637 | break; |
| 1638 | 1638 | default: |
| 1639 | 1639 | return new Response(0, PhpXmlRpc::$xmlrpcerr['multicall_error'], |
| 1640 | - PhpXmlRpc::$xmlrpcstr['multicall_error'] . ": response element $i is not an array or struct", |
|
| 1640 | + PhpXmlRpc::$xmlrpcstr['multicall_error'].": response element $i is not an array or struct", |
|
| 1641 | 1641 | 'xmlrpcvals', $result->httpResponse()); |
| 1642 | 1642 | } |
| 1643 | 1643 | } |
@@ -1670,7 +1670,7 @@ discard block |
||
| 1670 | 1670 | $authType = 1, $proxyHost = '', $proxyPort = 0, $proxyUsername = '', $proxyPassword = '', $proxyAuthType = 1, |
| 1671 | 1671 | $method = 'http') |
| 1672 | 1672 | { |
| 1673 | - $this->logDeprecation('Method ' . __METHOD__ . ' is deprecated'); |
|
| 1673 | + $this->logDeprecation('Method '.__METHOD__.' is deprecated'); |
|
| 1674 | 1674 | |
| 1675 | 1675 | return $this->sendPayloadSocket($req, $server, $port, $timeout, $username, $password, $authType, null, null, |
| 1676 | 1676 | null, null, $proxyHost, $proxyPort, $proxyUsername, $proxyPassword, $proxyAuthType, $method); |
@@ -1706,7 +1706,7 @@ discard block |
||
| 1706 | 1706 | $proxyUsername = '', $proxyPassword = '', $proxyAuthType = 1, $keepAlive = false, $key = '', $keyPass = '', |
| 1707 | 1707 | $sslVersion = 0) |
| 1708 | 1708 | { |
| 1709 | - $this->logDeprecation('Method ' . __METHOD__ . ' is deprecated'); |
|
| 1709 | + $this->logDeprecation('Method '.__METHOD__.' is deprecated'); |
|
| 1710 | 1710 | |
| 1711 | 1711 | return $this->sendPayloadCURL($req, $server, $port, $timeout, $username, |
| 1712 | 1712 | $password, $authType, $cert, $certPass, $caCert, $caCertDir, $proxyHost, $proxyPort, |
@@ -1917,7 +1917,7 @@ discard block |
||
| 1917 | 1917 | public function &__get($name) |
| 1918 | 1918 | { |
| 1919 | 1919 | if (in_array($name, static::$options)) { |
| 1920 | - $this->logDeprecation('Getting property Client::' . $name . ' is deprecated'); |
|
| 1920 | + $this->logDeprecation('Getting property Client::'.$name.' is deprecated'); |
|
| 1921 | 1921 | return $this->$name; |
| 1922 | 1922 | } |
| 1923 | 1923 | |
@@ -1928,12 +1928,12 @@ discard block |
||
| 1928 | 1928 | case 'server': |
| 1929 | 1929 | case 'port': |
| 1930 | 1930 | case 'path': |
| 1931 | - $this->logDeprecation('Getting property Client::' . $name . ' is deprecated'); |
|
| 1931 | + $this->logDeprecation('Getting property Client::'.$name.' is deprecated'); |
|
| 1932 | 1932 | return $this->$name; |
| 1933 | 1933 | default: |
| 1934 | 1934 | /// @todo throw instead? There are very few other places where the lib trigger errors which can potentially reach stdout... |
| 1935 | 1935 | $trace = debug_backtrace(DEBUG_BACKTRACE_IGNORE_ARGS, 1); |
| 1936 | - trigger_error('Undefined property via __get(): ' . $name . ' in ' . $trace[0]['file'] . ' on line ' . $trace[0]['line'], E_USER_WARNING); |
|
| 1936 | + trigger_error('Undefined property via __get(): '.$name.' in '.$trace[0]['file'].' on line '.$trace[0]['line'], E_USER_WARNING); |
|
| 1937 | 1937 | $result = null; |
| 1938 | 1938 | return $result; |
| 1939 | 1939 | } |
@@ -1942,7 +1942,7 @@ discard block |
||
| 1942 | 1942 | public function __set($name, $value) |
| 1943 | 1943 | { |
| 1944 | 1944 | if (in_array($name, static::$options)) { |
| 1945 | - $this->logDeprecation('Setting property Client::' . $name . ' is deprecated'); |
|
| 1945 | + $this->logDeprecation('Setting property Client::'.$name.' is deprecated'); |
|
| 1946 | 1946 | $this->$name = $value; |
| 1947 | 1947 | return; |
| 1948 | 1948 | } |
@@ -1954,20 +1954,20 @@ discard block |
||
| 1954 | 1954 | case 'server': |
| 1955 | 1955 | case 'port': |
| 1956 | 1956 | case 'path': |
| 1957 | - $this->logDeprecation('Setting property Client::' . $name . ' is deprecated'); |
|
| 1957 | + $this->logDeprecation('Setting property Client::'.$name.' is deprecated'); |
|
| 1958 | 1958 | $this->$name = $value; |
| 1959 | 1959 | return; |
| 1960 | 1960 | default: |
| 1961 | 1961 | /// @todo throw instead? There are very few other places where the lib trigger errors which can potentially reach stdout... |
| 1962 | 1962 | $trace = debug_backtrace(DEBUG_BACKTRACE_IGNORE_ARGS, 1); |
| 1963 | - trigger_error('Undefined property via __set(): ' . $name . ' in ' . $trace[0]['file'] . ' on line ' . $trace[0]['line'], E_USER_WARNING); |
|
| 1963 | + trigger_error('Undefined property via __set(): '.$name.' in '.$trace[0]['file'].' on line '.$trace[0]['line'], E_USER_WARNING); |
|
| 1964 | 1964 | } |
| 1965 | 1965 | } |
| 1966 | 1966 | |
| 1967 | 1967 | public function __isset($name) |
| 1968 | 1968 | { |
| 1969 | 1969 | if (in_array($name, static::$options)) { |
| 1970 | - $this->logDeprecation('Checking property Client::' . $name . ' is deprecated'); |
|
| 1970 | + $this->logDeprecation('Checking property Client::'.$name.' is deprecated'); |
|
| 1971 | 1971 | return isset($this->$name); |
| 1972 | 1972 | } |
| 1973 | 1973 | |
@@ -1978,7 +1978,7 @@ discard block |
||
| 1978 | 1978 | case 'server': |
| 1979 | 1979 | case 'port': |
| 1980 | 1980 | case 'path': |
| 1981 | - $this->logDeprecation('Checking property Client::' . $name . ' is deprecated'); |
|
| 1981 | + $this->logDeprecation('Checking property Client::'.$name.' is deprecated'); |
|
| 1982 | 1982 | return isset($this->$name); |
| 1983 | 1983 | default: |
| 1984 | 1984 | return false; |
@@ -1988,7 +1988,7 @@ discard block |
||
| 1988 | 1988 | public function __unset($name) |
| 1989 | 1989 | { |
| 1990 | 1990 | if (in_array($name, static::$options)) { |
| 1991 | - $this->logDeprecation('Unsetting property Client::' . $name . ' is deprecated'); |
|
| 1991 | + $this->logDeprecation('Unsetting property Client::'.$name.' is deprecated'); |
|
| 1992 | 1992 | unset($this->$name); |
| 1993 | 1993 | return; |
| 1994 | 1994 | } |
@@ -2000,13 +2000,13 @@ discard block |
||
| 2000 | 2000 | case 'server': |
| 2001 | 2001 | case 'port': |
| 2002 | 2002 | case 'path': |
| 2003 | - $this->logDeprecation('Unsetting property Client::' . $name . ' is deprecated'); |
|
| 2003 | + $this->logDeprecation('Unsetting property Client::'.$name.' is deprecated'); |
|
| 2004 | 2004 | unset($this->$name); |
| 2005 | 2005 | return; |
| 2006 | 2006 | default: |
| 2007 | 2007 | /// @todo throw instead? There are very few other places where the lib trigger errors which can potentially reach stdout... |
| 2008 | 2008 | $trace = debug_backtrace(DEBUG_BACKTRACE_IGNORE_ARGS, 1); |
| 2009 | - trigger_error('Undefined property via __unset(): ' . $name . ' in ' . $trace[0]['file'] . ' on line ' . $trace[0]['line'], E_USER_WARNING); |
|
| 2009 | + trigger_error('Undefined property via __unset(): '.$name.' in '.$trace[0]['file'].' on line '.$trace[0]['line'], E_USER_WARNING); |
|
| 2010 | 2010 | } |
| 2011 | 2011 | } |
| 2012 | 2012 | } |
@@ -84,7 +84,7 @@ discard block |
||
| 84 | 84 | |
| 85 | 85 | return true; |
| 86 | 86 | } else { |
| 87 | - $this->getLogger()->error('XML-RPC: ' . __METHOD__ . ': value passed in must be a PhpXmlRpc\Value'); |
|
| 87 | + $this->getLogger()->error('XML-RPC: '.__METHOD__.': value passed in must be a PhpXmlRpc\Value'); |
|
| 88 | 88 | return false; |
| 89 | 89 | } |
| 90 | 90 | } |
@@ -134,17 +134,17 @@ discard block |
||
| 134 | 134 | $this->logDeprecationUnlessCalledBy('serialize'); |
| 135 | 135 | |
| 136 | 136 | if ($charsetEncoding != '') { |
| 137 | - $this->content_type = 'text/xml; charset=' . $charsetEncoding; |
|
| 137 | + $this->content_type = 'text/xml; charset='.$charsetEncoding; |
|
| 138 | 138 | } else { |
| 139 | 139 | $this->content_type = 'text/xml'; |
| 140 | 140 | } |
| 141 | 141 | |
| 142 | 142 | $result = $this->xml_header($charsetEncoding); |
| 143 | - $result .= '<methodName>' . $this->getCharsetEncoder()->encodeEntities( |
|
| 144 | - $this->methodname, PhpXmlRpc::$xmlrpc_internalencoding, $charsetEncoding) . "</methodName>\n"; |
|
| 143 | + $result .= '<methodName>'.$this->getCharsetEncoder()->encodeEntities( |
|
| 144 | + $this->methodname, PhpXmlRpc::$xmlrpc_internalencoding, $charsetEncoding)."</methodName>\n"; |
|
| 145 | 145 | $result .= "<params>\n"; |
| 146 | 146 | foreach ($this->params as $p) { |
| 147 | - $result .= "<param>\n" . $p->serialize($charsetEncoding) . |
|
| 147 | + $result .= "<param>\n".$p->serialize($charsetEncoding). |
|
| 148 | 148 | "</param>\n"; |
| 149 | 149 | } |
| 150 | 150 | $result .= "</params>\n"; |
@@ -164,9 +164,9 @@ discard block |
||
| 164 | 164 | $this->logDeprecationUnlessCalledBy('createPayload'); |
| 165 | 165 | |
| 166 | 166 | if ($charsetEncoding != '') { |
| 167 | - return "<?xml version=\"1.0\" encoding=\"$charsetEncoding\" ?" . ">\n<methodCall>\n"; |
|
| 167 | + return "<?xml version=\"1.0\" encoding=\"$charsetEncoding\" ?".">\n<methodCall>\n"; |
|
| 168 | 168 | } else { |
| 169 | - return "<?xml version=\"1.0\"?" . ">\n<methodCall>\n"; |
|
| 169 | + return "<?xml version=\"1.0\"?".">\n<methodCall>\n"; |
|
| 170 | 170 | } |
| 171 | 171 | } |
| 172 | 172 | |
@@ -228,14 +228,14 @@ discard block |
||
| 228 | 228 | */ |
| 229 | 229 | public function parseResponse($data = '', $headersProcessed = false, $returnType = XMLParser::RETURN_XMLRPCVALS) |
| 230 | 230 | { |
| 231 | - if ($this->debug > 0) { |
|
| 231 | + if ($this->debug>0) { |
|
| 232 | 232 | $this->getLogger()->debug("---GOT---\n$data\n---END---"); |
| 233 | 233 | } |
| 234 | 234 | |
| 235 | 235 | $this->httpResponse = array('raw_data' => $data, 'headers' => array(), 'cookies' => array()); |
| 236 | 236 | |
| 237 | 237 | if ($data == '') { |
| 238 | - $this->getLogger()->error('XML-RPC: ' . __METHOD__ . ': no response received from server.'); |
|
| 238 | + $this->getLogger()->error('XML-RPC: '.__METHOD__.': no response received from server.'); |
|
| 239 | 239 | return new Response(0, PhpXmlRpc::$xmlrpcerr['no_data'], PhpXmlRpc::$xmlrpcstr['no_data']); |
| 240 | 240 | } |
| 241 | 241 | |
@@ -243,12 +243,12 @@ discard block |
||
| 243 | 243 | if (substr($data, 0, 4) == 'HTTP') { |
| 244 | 244 | $httpParser = new Http(); |
| 245 | 245 | try { |
| 246 | - $httpResponse = $httpParser->parseResponseHeaders($data, $headersProcessed, $this->debug > 0); |
|
| 246 | + $httpResponse = $httpParser->parseResponseHeaders($data, $headersProcessed, $this->debug>0); |
|
| 247 | 247 | } catch (HttpException $e) { |
| 248 | 248 | // failed processing of HTTP response headers |
| 249 | 249 | // save into response obj the full payload received, for debugging |
| 250 | 250 | return new Response(0, $e->getCode(), $e->getMessage(), '', array('raw_data' => $data, 'status_code', $e->statusCode())); |
| 251 | - } catch(\Exception $e) { |
|
| 251 | + } catch (\Exception $e) { |
|
| 252 | 252 | return new Response(0, $e->getCode(), $e->getMessage(), '', array('raw_data' => $data)); |
| 253 | 253 | } |
| 254 | 254 | } else { |
@@ -264,7 +264,7 @@ discard block |
||
| 264 | 264 | // idea from Luca Mariano, originally in PEARified version of the lib |
| 265 | 265 | $pos = strrpos($data, '</methodResponse>'); |
| 266 | 266 | if ($pos !== false) { |
| 267 | - $data = substr($data, 0, $pos + 17); |
|
| 267 | + $data = substr($data, 0, $pos+17); |
|
| 268 | 268 | } |
| 269 | 269 | |
| 270 | 270 | // try to 'guestimate' the character encoding of the received response |
@@ -273,21 +273,21 @@ discard block |
||
| 273 | 273 | $data |
| 274 | 274 | ); |
| 275 | 275 | |
| 276 | - if ($this->debug >= 0) { |
|
| 276 | + if ($this->debug>=0) { |
|
| 277 | 277 | $this->httpResponse = $httpResponse; |
| 278 | 278 | } else { |
| 279 | 279 | $httpResponse = null; |
| 280 | 280 | } |
| 281 | 281 | |
| 282 | - if ($this->debug > 0) { |
|
| 282 | + if ($this->debug>0) { |
|
| 283 | 283 | $start = strpos($data, '<!-- SERVER DEBUG INFO (BASE64 ENCODED):'); |
| 284 | 284 | if ($start) { |
| 285 | 285 | $start += strlen('<!-- SERVER DEBUG INFO (BASE64 ENCODED):'); |
| 286 | 286 | /// @todo what if there is no end tag? |
| 287 | 287 | $end = strpos($data, '-->', $start); |
| 288 | - $comments = substr($data, $start, $end - $start); |
|
| 289 | - $this->getLogger()->debug("---SERVER DEBUG INFO (DECODED)---\n\t" . |
|
| 290 | - str_replace("\n", "\n\t", base64_decode($comments)) . "\n---END---", array('encoding' => $respEncoding)); |
|
| 288 | + $comments = substr($data, $start, $end-$start); |
|
| 289 | + $this->getLogger()->debug("---SERVER DEBUG INFO (DECODED)---\n\t". |
|
| 290 | + str_replace("\n", "\n\t", base64_decode($comments))."\n---END---", array('encoding' => $respEncoding)); |
|
| 291 | 291 | } |
| 292 | 292 | } |
| 293 | 293 | |
@@ -309,7 +309,7 @@ discard block |
||
| 309 | 309 | if ($respEncoding == 'ISO-8859-1') { |
| 310 | 310 | $data = utf8_encode($data); |
| 311 | 311 | } else { |
| 312 | - $this->getLogger()->error('XML-RPC: ' . __METHOD__ . ': unsupported charset encoding of received response: ' . $respEncoding); |
|
| 312 | + $this->getLogger()->error('XML-RPC: '.__METHOD__.': unsupported charset encoding of received response: '.$respEncoding); |
|
| 313 | 313 | } |
| 314 | 314 | } |
| 315 | 315 | } |
@@ -339,16 +339,16 @@ discard block |
||
| 339 | 339 | // there could be proxies meddling with the request, or network data corruption... |
| 340 | 340 | |
| 341 | 341 | $r = new Response(0, PhpXmlRpc::$xmlrpcerr['invalid_xml'], |
| 342 | - PhpXmlRpc::$xmlrpcstr['invalid_xml'] . ' ' . $_xh['isf_reason'], '', $httpResponse); |
|
| 342 | + PhpXmlRpc::$xmlrpcstr['invalid_xml'].' '.$_xh['isf_reason'], '', $httpResponse); |
|
| 343 | 343 | |
| 344 | - if ($this->debug > 0) { |
|
| 344 | + if ($this->debug>0) { |
|
| 345 | 345 | $this->getLogger()->debug($_xh['isf_reason']); |
| 346 | 346 | } |
| 347 | 347 | } |
| 348 | 348 | // second error check: xml well-formed but not xml-rpc compliant |
| 349 | 349 | elseif ($_xh['isf'] == 2) { |
| 350 | 350 | $r = new Response(0, PhpXmlRpc::$xmlrpcerr['xml_not_compliant'], |
| 351 | - PhpXmlRpc::$xmlrpcstr['xml_not_compliant'] . ' ' . $_xh['isf_reason'], '', $httpResponse); |
|
| 351 | + PhpXmlRpc::$xmlrpcstr['xml_not_compliant'].' '.$_xh['isf_reason'], '', $httpResponse); |
|
| 352 | 352 | |
| 353 | 353 | /// @todo echo something for the user? check if it was already done by the parser... |
| 354 | 354 | //if ($this->debug > 0) { |
@@ -357,7 +357,7 @@ discard block |
||
| 357 | 357 | } |
| 358 | 358 | // third error check: parsing of the response has somehow gone boink. |
| 359 | 359 | /// @todo shall we omit this check, since we trust the parsing code? |
| 360 | - elseif ($_xh['isf'] > 3 || $returnType == XMLParser::RETURN_XMLRPCVALS && !is_object($_xh['value'])) { |
|
| 360 | + elseif ($_xh['isf']>3 || $returnType == XMLParser::RETURN_XMLRPCVALS && !is_object($_xh['value'])) { |
|
| 361 | 361 | // something odd has happened and it's time to generate a client side error indicating something odd went on |
| 362 | 362 | $r = new Response(0, PhpXmlRpc::$xmlrpcerr['xml_parsing_error'], PhpXmlRpc::$xmlrpcstr['xml_parsing_error'], |
| 363 | 363 | '', $httpResponse |
@@ -365,7 +365,7 @@ discard block |
||
| 365 | 365 | |
| 366 | 366 | /// @todo echo something for the user? |
| 367 | 367 | } else { |
| 368 | - if ($this->debug > 1) { |
|
| 368 | + if ($this->debug>1) { |
|
| 369 | 369 | $this->getLogger()->debug( |
| 370 | 370 | "---PARSED---\n".var_export($_xh['value'], true)."\n---END---" |
| 371 | 371 | ); |
@@ -389,7 +389,7 @@ discard block |
||
| 389 | 389 | if ($errNo == 0) { |
| 390 | 390 | // FAULT returned, errno needs to reflect that |
| 391 | 391 | /// @todo feature creep - add this code to PhpXmlRpc::$xmlrpcerr |
| 392 | - $this->getLogger()->error('XML-RPC: ' . __METHOD__ . ': fault response received with faultCode 0 or null. Converted it to -1'); |
|
| 392 | + $this->getLogger()->error('XML-RPC: '.__METHOD__.': fault response received with faultCode 0 or null. Converted it to -1'); |
|
| 393 | 393 | /// @todo in Encoder::decodeXML, we use PhpXmlRpc::$xmlrpcerr['invalid_return'] for this case (see |
| 394 | 394 | /// also the todo 17 lines above) |
| 395 | 395 | $errNo = -1; |
@@ -437,7 +437,7 @@ discard block |
||
| 437 | 437 | case '_php_class': |
| 438 | 438 | case 'payload': |
| 439 | 439 | case 'content_type': |
| 440 | - $this->logDeprecation('Getting property Request::' . $name . ' is deprecated'); |
|
| 440 | + $this->logDeprecation('Getting property Request::'.$name.' is deprecated'); |
|
| 441 | 441 | return $this->$name; |
| 442 | 442 | case 'httpResponse': |
| 443 | 443 | // manually implement the 'protected property' behaviour |
@@ -449,16 +449,16 @@ discard block |
||
| 449 | 449 | } |
| 450 | 450 | } |
| 451 | 451 | if ($canAccess) { |
| 452 | - $this->logDeprecation('Getting property Request::' . $name . ' is deprecated'); |
|
| 452 | + $this->logDeprecation('Getting property Request::'.$name.' is deprecated'); |
|
| 453 | 453 | return $this->httpResponse; |
| 454 | 454 | } else { |
| 455 | - trigger_error("Cannot access protected property Request::httpResponse in " . __FILE__, E_USER_ERROR); |
|
| 455 | + trigger_error("Cannot access protected property Request::httpResponse in ".__FILE__, E_USER_ERROR); |
|
| 456 | 456 | } |
| 457 | 457 | break; |
| 458 | 458 | default: |
| 459 | 459 | /// @todo throw instead? There are very few other places where the lib trigger errors which can potentially reach stdout... |
| 460 | 460 | $trace = debug_backtrace(DEBUG_BACKTRACE_IGNORE_ARGS, 1); |
| 461 | - trigger_error('Undefined property via __get(): ' . $name . ' in ' . $trace[0]['file'] . ' on line ' . $trace[0]['line'], E_USER_WARNING); |
|
| 461 | + trigger_error('Undefined property via __get(): '.$name.' in '.$trace[0]['file'].' on line '.$trace[0]['line'], E_USER_WARNING); |
|
| 462 | 462 | $result = null; |
| 463 | 463 | return $result; |
| 464 | 464 | } |
@@ -472,7 +472,7 @@ discard block |
||
| 472 | 472 | case 'debug': |
| 473 | 473 | case 'payload': |
| 474 | 474 | case 'content_type': |
| 475 | - $this->logDeprecation('Setting property Request::' . $name . ' is deprecated'); |
|
| 475 | + $this->logDeprecation('Setting property Request::'.$name.' is deprecated'); |
|
| 476 | 476 | $this->$name = $value; |
| 477 | 477 | break; |
| 478 | 478 | case 'httpResponse': |
@@ -485,16 +485,16 @@ discard block |
||
| 485 | 485 | } |
| 486 | 486 | } |
| 487 | 487 | if ($canAccess) { |
| 488 | - $this->logDeprecation('Setting property Request::' . $name . ' is deprecated'); |
|
| 488 | + $this->logDeprecation('Setting property Request::'.$name.' is deprecated'); |
|
| 489 | 489 | $this->httpResponse = $value; |
| 490 | 490 | } else { |
| 491 | - trigger_error("Cannot access protected property Request::httpResponse in " . __FILE__, E_USER_ERROR); |
|
| 491 | + trigger_error("Cannot access protected property Request::httpResponse in ".__FILE__, E_USER_ERROR); |
|
| 492 | 492 | } |
| 493 | 493 | break; |
| 494 | 494 | default: |
| 495 | 495 | /// @todo throw instead? There are very few other places where the lib trigger errors which can potentially reach stdout... |
| 496 | 496 | $trace = debug_backtrace(DEBUG_BACKTRACE_IGNORE_ARGS, 1); |
| 497 | - trigger_error('Undefined property via __set(): ' . $name . ' in ' . $trace[0]['file'] . ' on line ' . $trace[0]['line'], E_USER_WARNING); |
|
| 497 | + trigger_error('Undefined property via __set(): '.$name.' in '.$trace[0]['file'].' on line '.$trace[0]['line'], E_USER_WARNING); |
|
| 498 | 498 | } |
| 499 | 499 | } |
| 500 | 500 | |
@@ -506,7 +506,7 @@ discard block |
||
| 506 | 506 | case 'debug': |
| 507 | 507 | case 'payload': |
| 508 | 508 | case 'content_type': |
| 509 | - $this->logDeprecation('Checking property Request::' . $name . ' is deprecated'); |
|
| 509 | + $this->logDeprecation('Checking property Request::'.$name.' is deprecated'); |
|
| 510 | 510 | return isset($this->$name); |
| 511 | 511 | case 'httpResponse': |
| 512 | 512 | // manually implement the 'protected property' behaviour |
@@ -518,7 +518,7 @@ discard block |
||
| 518 | 518 | } |
| 519 | 519 | } |
| 520 | 520 | if ($canAccess) { |
| 521 | - $this->logDeprecation('Checking property Request::' . $name . ' is deprecated'); |
|
| 521 | + $this->logDeprecation('Checking property Request::'.$name.' is deprecated'); |
|
| 522 | 522 | return isset($this->httpResponse); |
| 523 | 523 | } |
| 524 | 524 | // break through voluntarily |
@@ -535,7 +535,7 @@ discard block |
||
| 535 | 535 | case 'debug': |
| 536 | 536 | case 'payload': |
| 537 | 537 | case 'content_type': |
| 538 | - $this->logDeprecation('Unsetting property Request::' . $name . ' is deprecated'); |
|
| 538 | + $this->logDeprecation('Unsetting property Request::'.$name.' is deprecated'); |
|
| 539 | 539 | unset($this->$name); |
| 540 | 540 | break; |
| 541 | 541 | case 'httpResponse': |
@@ -548,16 +548,16 @@ discard block |
||
| 548 | 548 | } |
| 549 | 549 | } |
| 550 | 550 | if ($canAccess) { |
| 551 | - $this->logDeprecation('Unsetting property Request::' . $name . ' is deprecated'); |
|
| 551 | + $this->logDeprecation('Unsetting property Request::'.$name.' is deprecated'); |
|
| 552 | 552 | unset($this->httpResponse); |
| 553 | 553 | } else { |
| 554 | - trigger_error("Cannot access protected property Request::httpResponse in " . __FILE__, E_USER_ERROR); |
|
| 554 | + trigger_error("Cannot access protected property Request::httpResponse in ".__FILE__, E_USER_ERROR); |
|
| 555 | 555 | } |
| 556 | 556 | break; |
| 557 | 557 | default: |
| 558 | 558 | /// @todo throw instead? There are very few other places where the lib trigger errors which can potentially reach stdout... |
| 559 | 559 | $trace = debug_backtrace(DEBUG_BACKTRACE_IGNORE_ARGS, 1); |
| 560 | - trigger_error('Undefined property via __unset(): ' . $name . ' in ' . $trace[0]['file'] . ' on line ' . $trace[0]['line'], E_USER_WARNING); |
|
| 560 | + trigger_error('Undefined property via __unset(): '.$name.' in '.$trace[0]['file'].' on line '.$trace[0]['line'], E_USER_WARNING); |
|
| 561 | 561 | } |
| 562 | 562 | } |
| 563 | 563 | } |
@@ -1,6 +1,6 @@ discard block |
||
| 1 | 1 | <?php |
| 2 | 2 | |
| 3 | -include_once __DIR__ . '/08ServerTest.php'; |
|
| 3 | +include_once __DIR__.'/08ServerTest.php'; |
|
| 4 | 4 | |
| 5 | 5 | /** |
| 6 | 6 | * Tests which stress http features of the library. |
@@ -25,7 +25,7 @@ discard block |
||
| 25 | 25 | ); |
| 26 | 26 | |
| 27 | 27 | $methods = array(); |
| 28 | - foreach(get_class_methods('ServerTest') as $method) |
|
| 28 | + foreach (get_class_methods('ServerTest') as $method) |
|
| 29 | 29 | { |
| 30 | 30 | if (strpos($method, 'test') === 0 && !in_array($method, $unsafeMethods)) |
| 31 | 31 | { |
@@ -317,7 +317,7 @@ discard block |
||
| 317 | 317 | preg_match('/ubunutu([0-9]+)/', $output[0], $matches); |
| 318 | 318 | $ubuntuVersion = @$matches[1]; |
| 319 | 319 | } |
| 320 | - if ($ubuntuVersion >= 20) { |
|
| 320 | + if ($ubuntuVersion>=20) { |
|
| 321 | 321 | $this->markTestSkipped('HTTPS via Socket known to fail on php less than 7.2 on Ubuntu 20 and higher'); |
| 322 | 322 | return; |
| 323 | 323 | } |
@@ -336,7 +336,7 @@ discard block |
||
| 336 | 336 | { |
| 337 | 337 | $version = explode('.', PHP_VERSION); |
| 338 | 338 | $this->client->setOption(\PhpXmlRpc\Client::OPT_EXTRA_SOCKET_OPTS, |
| 339 | - array('ssl' => array('security_level' => 2 + $version[1]))); |
|
| 339 | + array('ssl' => array('security_level' => 2+$version[1]))); |
|
| 340 | 340 | } |
| 341 | 341 | |
| 342 | 342 | $this->$method(); |