@@ -354,10 +354,10 @@ discard block |
||
354 | 354 | $server = $parts['host']; |
355 | 355 | $path = isset($parts['path']) ? $parts['path'] : ''; |
356 | 356 | if (isset($parts['query'])) { |
357 | - $path .= '?' . $parts['query']; |
|
357 | + $path .= '?'.$parts['query']; |
|
358 | 358 | } |
359 | 359 | if (isset($parts['fragment'])) { |
360 | - $path .= '#' . $parts['fragment']; |
|
360 | + $path .= '#'.$parts['fragment']; |
|
361 | 361 | } |
362 | 362 | if (isset($parts['port'])) { |
363 | 363 | $port = $parts['port']; |
@@ -373,7 +373,7 @@ discard block |
||
373 | 373 | } |
374 | 374 | } |
375 | 375 | if ($path == '' || $path[0] != '/') { |
376 | - $this->path = '/' . $path; |
|
376 | + $this->path = '/'.$path; |
|
377 | 377 | } else { |
378 | 378 | $this->path = $path; |
379 | 379 | } |
@@ -405,7 +405,7 @@ discard block |
||
405 | 405 | //$this->accepted_charset_encodings = $ch->knownCharsets(); |
406 | 406 | |
407 | 407 | // initialize user_agent string |
408 | - $this->user_agent = PhpXmlRpc::$xmlrpcName . ' ' . PhpXmlRpc::$xmlrpcVersion; |
|
408 | + $this->user_agent = PhpXmlRpc::$xmlrpcName.' '.PhpXmlRpc::$xmlrpcVersion; |
|
409 | 409 | } |
410 | 410 | |
411 | 411 | /** |
@@ -594,7 +594,7 @@ discard block |
||
594 | 594 | public function getOptions() |
595 | 595 | { |
596 | 596 | $values = array(); |
597 | - foreach($this->options as $opt) { |
|
597 | + foreach ($this->options as $opt) { |
|
598 | 598 | $values[$opt] = $this->getOption($opt); |
599 | 599 | } |
600 | 600 | return $values; |
@@ -607,7 +607,7 @@ discard block |
||
607 | 607 | */ |
608 | 608 | public function setOptions($options) |
609 | 609 | { |
610 | - foreach($options as $name => $value) { |
|
610 | + foreach ($options as $name => $value) { |
|
611 | 611 | $this->setOption($name, $value); |
612 | 612 | } |
613 | 613 | |
@@ -726,7 +726,7 @@ discard block |
||
726 | 726 | */ |
727 | 727 | public function setSSLVerifyPeer($i) |
728 | 728 | { |
729 | - $this->logDeprecation('Method ' . __METHOD__ . ' is deprecated'); |
|
729 | + $this->logDeprecation('Method '.__METHOD__.' is deprecated'); |
|
730 | 730 | |
731 | 731 | $this->verifypeer = $i; |
732 | 732 | return $this; |
@@ -743,7 +743,7 @@ discard block |
||
743 | 743 | */ |
744 | 744 | public function setSSLVerifyHost($i) |
745 | 745 | { |
746 | - $this->logDeprecation('Method ' . __METHOD__ . ' is deprecated'); |
|
746 | + $this->logDeprecation('Method '.__METHOD__.' is deprecated'); |
|
747 | 747 | |
748 | 748 | $this->verifyhost = $i; |
749 | 749 | return $this; |
@@ -758,7 +758,7 @@ discard block |
||
758 | 758 | */ |
759 | 759 | public function setSSLVersion($i) |
760 | 760 | { |
761 | - $this->logDeprecation('Method ' . __METHOD__ . ' is deprecated'); |
|
761 | + $this->logDeprecation('Method '.__METHOD__.' is deprecated'); |
|
762 | 762 | |
763 | 763 | $this->sslversion = $i; |
764 | 764 | return $this; |
@@ -823,7 +823,7 @@ discard block |
||
823 | 823 | */ |
824 | 824 | public function setRequestCompression($compMethod) |
825 | 825 | { |
826 | - $this->logDeprecation('Method ' . __METHOD__ . ' is deprecated'); |
|
826 | + $this->logDeprecation('Method '.__METHOD__.' is deprecated'); |
|
827 | 827 | |
828 | 828 | $this->request_compression = $compMethod; |
829 | 829 | return $this; |
@@ -874,7 +874,7 @@ discard block |
||
874 | 874 | */ |
875 | 875 | public function setCurlOptions($options) |
876 | 876 | { |
877 | - $this->logDeprecation('Method ' . __METHOD__ . ' is deprecated'); |
|
877 | + $this->logDeprecation('Method '.__METHOD__.' is deprecated'); |
|
878 | 878 | |
879 | 879 | $this->extracurlopts = $options; |
880 | 880 | return $this; |
@@ -887,7 +887,7 @@ discard block |
||
887 | 887 | */ |
888 | 888 | public function setUseCurl($useCurlMode) |
889 | 889 | { |
890 | - $this->logDeprecation('Method ' . __METHOD__ . ' is deprecated'); |
|
890 | + $this->logDeprecation('Method '.__METHOD__.' is deprecated'); |
|
891 | 891 | |
892 | 892 | $this->use_curl = $useCurlMode; |
893 | 893 | return $this; |
@@ -905,7 +905,7 @@ discard block |
||
905 | 905 | */ |
906 | 906 | public function setUserAgent($agentString) |
907 | 907 | { |
908 | - $this->logDeprecation('Method ' . __METHOD__ . ' is deprecated'); |
|
908 | + $this->logDeprecation('Method '.__METHOD__.' is deprecated'); |
|
909 | 909 | |
910 | 910 | $this->user_agent = $agentString; |
911 | 911 | return $this; |
@@ -916,12 +916,12 @@ discard block |
||
916 | 916 | */ |
917 | 917 | public function getUrl() |
918 | 918 | { |
919 | - $url = $this->method . '://' . $this->server; |
|
919 | + $url = $this->method.'://'.$this->server; |
|
920 | 920 | if (($this->port = 80 && in_array($this->method, array('http', 'http10', 'http11', 'h2c'))) && |
921 | 921 | ($this->port = 443 && in_array($this->method, array('https', 'h2')))) { |
922 | - return $url . $this->path; |
|
922 | + return $url.$this->path; |
|
923 | 923 | } else { |
924 | - return $url . ':' . $this->port . $this->path; |
|
924 | + return $url.':'.$this->port.$this->path; |
|
925 | 925 | } |
926 | 926 | } |
927 | 927 | |
@@ -961,7 +961,7 @@ discard block |
||
961 | 961 | public function send($req, $timeout = 0, $method = '') |
962 | 962 | { |
963 | 963 | if ($method !== '' || $timeout !== 0) { |
964 | - $this->logDeprecation("Using non-default values for arguments 'method' and 'timeout' when calling method " . __METHOD__ . ' is deprecated'); |
|
964 | + $this->logDeprecation("Using non-default values for arguments 'method' and 'timeout' when calling method ".__METHOD__.' is deprecated'); |
|
965 | 965 | } |
966 | 966 | |
967 | 967 | // if user does not specify http protocol, use native method of this client |
@@ -1066,9 +1066,9 @@ discard block |
||
1066 | 1066 | */ |
1067 | 1067 | protected function sendPayloadHTTP10($req, $server, $port, $timeout = 0, $username = '', $password = '', |
1068 | 1068 | $authType = 1, $proxyHost = '', $proxyPort = 0, $proxyUsername = '', $proxyPassword = '', $proxyAuthType = 1, |
1069 | - $method='http') |
|
1069 | + $method = 'http') |
|
1070 | 1070 | { |
1071 | - $this->logDeprecation('Method ' . __METHOD__ . ' is deprecated'); |
|
1071 | + $this->logDeprecation('Method '.__METHOD__.' is deprecated'); |
|
1072 | 1072 | |
1073 | 1073 | return $this->sendPayloadSocket($req, $server, $port, $timeout, $username, $password, $authType, null, null, |
1074 | 1074 | null, null, $proxyHost, $proxyPort, $proxyUsername, $proxyPassword, $proxyAuthType, $method); |
@@ -1099,12 +1099,12 @@ discard block |
||
1099 | 1099 | * @param int $sslVersion |
1100 | 1100 | * @return Response |
1101 | 1101 | */ |
1102 | - protected function sendPayloadHTTPS($req, $server, $port, $timeout = 0, $username = '', $password = '', |
|
1102 | + protected function sendPayloadHTTPS($req, $server, $port, $timeout = 0, $username = '', $password = '', |
|
1103 | 1103 | $authType = 1, $cert = '', $certPass = '', $caCert = '', $caCertDir = '', $proxyHost = '', $proxyPort = 0, |
1104 | 1104 | $proxyUsername = '', $proxyPassword = '', $proxyAuthType = 1, $keepAlive = false, $key = '', $keyPass = '', |
1105 | 1105 | $sslVersion = 0) |
1106 | 1106 | { |
1107 | - $this->logDeprecation('Method ' . __METHOD__ . ' is deprecated'); |
|
1107 | + $this->logDeprecation('Method '.__METHOD__.' is deprecated'); |
|
1108 | 1108 | |
1109 | 1109 | return $this->sendPayloadCURL($req, $server, $port, $timeout, $username, |
1110 | 1110 | $password, $authType, $cert, $certPass, $caCert, $caCertDir, $proxyHost, $proxyPort, |
@@ -1138,7 +1138,7 @@ discard block |
||
1138 | 1138 | */ |
1139 | 1139 | protected function sendPayloadSocket($req, $server, $port, $timeout = 0, $username = '', $password = '', |
1140 | 1140 | $authType = 1, $cert = '', $certPass = '', $caCert = '', $caCertDir = '', $proxyHost = '', $proxyPort = 0, |
1141 | - $proxyUsername = '', $proxyPassword = '', $proxyAuthType = 1, $method='http', $key = '', $keyPass = '', |
|
1141 | + $proxyUsername = '', $proxyPassword = '', $proxyAuthType = 1, $method = 'http', $key = '', $keyPass = '', |
|
1142 | 1142 | $sslVersion = 0) |
1143 | 1143 | { |
1144 | 1144 | /// @todo log a warning if passed an unsupported method |
@@ -1171,16 +1171,16 @@ discard block |
||
1171 | 1171 | // thanks to Grant Rauscher <[email protected]> for this |
1172 | 1172 | $credentials = ''; |
1173 | 1173 | if ($username != '') { |
1174 | - $credentials = 'Authorization: Basic ' . base64_encode($username . ':' . $password) . "\r\n"; |
|
1174 | + $credentials = 'Authorization: Basic '.base64_encode($username.':'.$password)."\r\n"; |
|
1175 | 1175 | if ($authType != 1) { |
1176 | 1176 | /// @todo make this a proper error, i.e. return a failure |
1177 | - $this->getLogger()->error('XML-RPC: ' . __METHOD__ . ': warning. Only Basic auth is supported with HTTP 1.0'); |
|
1177 | + $this->getLogger()->error('XML-RPC: '.__METHOD__.': warning. Only Basic auth is supported with HTTP 1.0'); |
|
1178 | 1178 | } |
1179 | 1179 | } |
1180 | 1180 | |
1181 | 1181 | $acceptedEncoding = ''; |
1182 | 1182 | if (is_array($this->accepted_compression) && count($this->accepted_compression)) { |
1183 | - $acceptedEncoding = 'Accept-Encoding: ' . implode(', ', $this->accepted_compression) . "\r\n"; |
|
1183 | + $acceptedEncoding = 'Accept-Encoding: '.implode(', ', $this->accepted_compression)."\r\n"; |
|
1184 | 1184 | } |
1185 | 1185 | |
1186 | 1186 | if ($port == 0) { |
@@ -1196,13 +1196,13 @@ discard block |
||
1196 | 1196 | $connectPort = $proxyPort; |
1197 | 1197 | $transport = 'tcp'; |
1198 | 1198 | /// @todo check: should we not use https in some cases? |
1199 | - $uri = 'http://' . $server . ':' . $port . $this->path; |
|
1199 | + $uri = 'http://'.$server.':'.$port.$this->path; |
|
1200 | 1200 | if ($proxyUsername != '') { |
1201 | 1201 | if ($proxyAuthType != 1) { |
1202 | 1202 | /// @todo make this a proper error, i.e. return a failure |
1203 | - $this->getLogger()->error('XML-RPC: ' . __METHOD__ . ': warning. Only Basic auth to proxy is supported with HTTP 1.0'); |
|
1203 | + $this->getLogger()->error('XML-RPC: '.__METHOD__.': warning. Only Basic auth to proxy is supported with HTTP 1.0'); |
|
1204 | 1204 | } |
1205 | - $proxyCredentials = 'Proxy-Authorization: Basic ' . base64_encode($proxyUsername . ':' . $proxyPassword) . "\r\n"; |
|
1205 | + $proxyCredentials = 'Proxy-Authorization: Basic '.base64_encode($proxyUsername.':'.$proxyPassword)."\r\n"; |
|
1206 | 1206 | } |
1207 | 1207 | } else { |
1208 | 1208 | $connectServer = $server; |
@@ -1217,32 +1217,32 @@ discard block |
||
1217 | 1217 | $version = ''; |
1218 | 1218 | foreach ($this->cookies as $name => $cookie) { |
1219 | 1219 | /// @todo should we sanitize the cookie name/value on behalf of the user? |
1220 | - $cookieHeader .= ' ' . $name . '=' . $cookie['value'] . ";"; |
|
1220 | + $cookieHeader .= ' '.$name.'='.$cookie['value'].";"; |
|
1221 | 1221 | } |
1222 | - $cookieHeader = 'Cookie:' . $version . substr($cookieHeader, 0, -1) . "\r\n"; |
|
1222 | + $cookieHeader = 'Cookie:'.$version.substr($cookieHeader, 0, -1)."\r\n"; |
|
1223 | 1223 | } |
1224 | 1224 | |
1225 | 1225 | // omit port if default |
1226 | 1226 | if (($port == 80 && in_array($method, array('http', 'http10'))) || ($port == 443 && $method == 'https')) { |
1227 | - $port = ''; |
|
1227 | + $port = ''; |
|
1228 | 1228 | } else { |
1229 | - $port = ':' . $port; |
|
1229 | + $port = ':'.$port; |
|
1230 | 1230 | } |
1231 | 1231 | |
1232 | - $op = 'POST ' . $uri . " HTTP/1.0\r\n" . |
|
1233 | - 'User-Agent: ' . $this->user_agent . "\r\n" . |
|
1234 | - 'Host: ' . $server . $port . "\r\n" . |
|
1235 | - $credentials . |
|
1236 | - $proxyCredentials . |
|
1237 | - $acceptedEncoding . |
|
1238 | - $encodingHdr . |
|
1239 | - 'Accept-Charset: ' . implode(',', $this->accepted_charset_encodings) . "\r\n" . |
|
1240 | - $cookieHeader . |
|
1241 | - 'Content-Type: ' . $req->content_type . "\r\nContent-Length: " . |
|
1242 | - strlen($payload) . "\r\n\r\n" . |
|
1232 | + $op = 'POST '.$uri." HTTP/1.0\r\n". |
|
1233 | + 'User-Agent: '.$this->user_agent."\r\n". |
|
1234 | + 'Host: '.$server.$port."\r\n". |
|
1235 | + $credentials. |
|
1236 | + $proxyCredentials. |
|
1237 | + $acceptedEncoding. |
|
1238 | + $encodingHdr. |
|
1239 | + 'Accept-Charset: '.implode(',', $this->accepted_charset_encodings)."\r\n". |
|
1240 | + $cookieHeader. |
|
1241 | + 'Content-Type: '.$req->content_type."\r\nContent-Length: ". |
|
1242 | + strlen($payload)."\r\n\r\n". |
|
1243 | 1243 | $payload; |
1244 | 1244 | |
1245 | - if ($this->debug > 1) { |
|
1245 | + if ($this->debug>1) { |
|
1246 | 1246 | $this->getLogger()->debug("---SENDING---\n$op\n---END---"); |
1247 | 1247 | } |
1248 | 1248 | |
@@ -1269,7 +1269,7 @@ discard block |
||
1269 | 1269 | |
1270 | 1270 | $context = stream_context_create($contextOptions); |
1271 | 1271 | |
1272 | - if ($timeout <= 0) { |
|
1272 | + if ($timeout<=0) { |
|
1273 | 1273 | $connectTimeout = ini_get('default_socket_timeout'); |
1274 | 1274 | } else { |
1275 | 1275 | $connectTimeout = $timeout; |
@@ -1281,7 +1281,7 @@ discard block |
||
1281 | 1281 | $fp = @stream_socket_client("$transport://$connectServer:$connectPort", $this->errno, $this->errstr, $connectTimeout, |
1282 | 1282 | STREAM_CLIENT_CONNECT, $context); |
1283 | 1283 | if ($fp) { |
1284 | - if ($timeout > 0) { |
|
1284 | + if ($timeout>0) { |
|
1285 | 1285 | stream_set_timeout($fp, $timeout, 0); |
1286 | 1286 | } |
1287 | 1287 | } else { |
@@ -1290,8 +1290,8 @@ discard block |
||
1290 | 1290 | $this->errstr = $err['message']; |
1291 | 1291 | } |
1292 | 1292 | |
1293 | - $this->errstr = 'Connect error: ' . $this->errstr; |
|
1294 | - $r = new static::$responseClass(0, PhpXmlRpc::$xmlrpcerr['http_error'], $this->errstr . ' (' . $this->errno . ')'); |
|
1293 | + $this->errstr = 'Connect error: '.$this->errstr; |
|
1294 | + $r = new static::$responseClass(0, PhpXmlRpc::$xmlrpcerr['http_error'], $this->errstr.' ('.$this->errno.')'); |
|
1295 | 1295 | |
1296 | 1296 | return $r; |
1297 | 1297 | } |
@@ -1379,18 +1379,18 @@ discard block |
||
1379 | 1379 | $keyPass, $sslVersion); |
1380 | 1380 | |
1381 | 1381 | if (!$curl) { |
1382 | - return new static::$responseClass(0, PhpXmlRpc::$xmlrpcerr['curl_fail'], PhpXmlRpc::$xmlrpcstr['curl_fail'] . ': error during curl initialization. Check php error log for details'); |
|
1382 | + return new static::$responseClass(0, PhpXmlRpc::$xmlrpcerr['curl_fail'], PhpXmlRpc::$xmlrpcstr['curl_fail'].': error during curl initialization. Check php error log for details'); |
|
1383 | 1383 | } |
1384 | 1384 | |
1385 | 1385 | $result = curl_exec($curl); |
1386 | 1386 | |
1387 | - if ($this->debug > 1) { |
|
1387 | + if ($this->debug>1) { |
|
1388 | 1388 | $message = "---CURL INFO---\n"; |
1389 | 1389 | foreach (curl_getinfo($curl) as $name => $val) { |
1390 | 1390 | if (is_array($val)) { |
1391 | 1391 | $val = implode("\n", $val); |
1392 | 1392 | } |
1393 | - $message .= $name . ': ' . $val . "\n"; |
|
1393 | + $message .= $name.': '.$val."\n"; |
|
1394 | 1394 | } |
1395 | 1395 | $message .= '---END---'; |
1396 | 1396 | $this->getLogger()->debug($message); |
@@ -1400,7 +1400,7 @@ discard block |
||
1400 | 1400 | /// @todo we should use a better check here - what if we get back '' or '0'? |
1401 | 1401 | |
1402 | 1402 | $this->errstr = 'no response'; |
1403 | - $resp = new static::$responseClass(0, PhpXmlRpc::$xmlrpcerr['curl_fail'], PhpXmlRpc::$xmlrpcstr['curl_fail'] . ': ' . curl_error($curl)); |
|
1403 | + $resp = new static::$responseClass(0, PhpXmlRpc::$xmlrpcerr['curl_fail'], PhpXmlRpc::$xmlrpcstr['curl_fail'].': '.curl_error($curl)); |
|
1404 | 1404 | curl_close($curl); |
1405 | 1405 | if ($keepAlive) { |
1406 | 1406 | $this->xmlrpc_curl_handle = null; |
@@ -1470,12 +1470,12 @@ discard block |
||
1470 | 1470 | // http, https |
1471 | 1471 | $protocol = $method; |
1472 | 1472 | if (strpos($protocol, ':') !== false) { |
1473 | - $this->getLogger()->error('XML-RPC: ' . __METHOD__ . ": warning - attempted hacking attempt?. The curl protocol requested for the call is: '$protocol'"); |
|
1473 | + $this->getLogger()->error('XML-RPC: '.__METHOD__.": warning - attempted hacking attempt?. The curl protocol requested for the call is: '$protocol'"); |
|
1474 | 1474 | return false; |
1475 | 1475 | } |
1476 | 1476 | } |
1477 | 1477 | } |
1478 | - $curl = curl_init($protocol . '://' . $server . ':' . $port . $this->path); |
|
1478 | + $curl = curl_init($protocol.'://'.$server.':'.$port.$this->path); |
|
1479 | 1479 | if (!$curl) { |
1480 | 1480 | return false; |
1481 | 1481 | } |
@@ -1489,7 +1489,7 @@ discard block |
||
1489 | 1489 | // results into variable |
1490 | 1490 | curl_setopt($curl, CURLOPT_RETURNTRANSFER, true); |
1491 | 1491 | |
1492 | - if ($this->debug > 1) { |
|
1492 | + if ($this->debug>1) { |
|
1493 | 1493 | curl_setopt($curl, CURLOPT_VERBOSE, true); |
1494 | 1494 | /// @todo redirect curlopt_stderr to some stream which can be piped to the logger |
1495 | 1495 | } |
@@ -1514,7 +1514,7 @@ discard block |
||
1514 | 1514 | } |
1515 | 1515 | } |
1516 | 1516 | // extra headers |
1517 | - $headers = array('Content-Type: ' . $req->content_type, 'Accept-Charset: ' . implode(',', $this->accepted_charset_encodings)); |
|
1517 | + $headers = array('Content-Type: '.$req->content_type, 'Accept-Charset: '.implode(',', $this->accepted_charset_encodings)); |
|
1518 | 1518 | // if no keepalive is wanted, let the server know it in advance |
1519 | 1519 | if (!$keepAlive) { |
1520 | 1520 | $headers[] = 'Connection: close'; |
@@ -1531,7 +1531,7 @@ discard block |
||
1531 | 1531 | curl_setopt($curl, CURLOPT_HTTPHEADER, $headers); |
1532 | 1532 | // timeout is borked |
1533 | 1533 | if ($timeout) { |
1534 | - curl_setopt($curl, CURLOPT_TIMEOUT, $timeout == 1 ? 1 : $timeout - 1); |
|
1534 | + curl_setopt($curl, CURLOPT_TIMEOUT, $timeout == 1 ? 1 : $timeout-1); |
|
1535 | 1535 | } |
1536 | 1536 | |
1537 | 1537 | switch ($method) { |
@@ -1546,7 +1546,7 @@ discard block |
||
1546 | 1546 | curl_setopt($curl, CURLOPT_HTTP_VERSION, CURL_HTTP_VERSION_2_PRIOR_KNOWLEDGE); |
1547 | 1547 | } else { |
1548 | 1548 | /// @todo make this a proper error, i.e. return a failure |
1549 | - $this->getLogger()->error('XML-RPC: ' . __METHOD__ . ': warning. HTTP2 is not supported by the current PHP/curl install'); |
|
1549 | + $this->getLogger()->error('XML-RPC: '.__METHOD__.': warning. HTTP2 is not supported by the current PHP/curl install'); |
|
1550 | 1550 | } |
1551 | 1551 | break; |
1552 | 1552 | case 'h2': |
@@ -1555,12 +1555,12 @@ discard block |
||
1555 | 1555 | } |
1556 | 1556 | |
1557 | 1557 | if ($username && $password) { |
1558 | - curl_setopt($curl, CURLOPT_USERPWD, $username . ':' . $password); |
|
1558 | + curl_setopt($curl, CURLOPT_USERPWD, $username.':'.$password); |
|
1559 | 1559 | if (defined('CURLOPT_HTTPAUTH')) { |
1560 | 1560 | curl_setopt($curl, CURLOPT_HTTPAUTH, $authType); |
1561 | 1561 | } elseif ($authType != 1) { |
1562 | 1562 | /// @todo make this a proper error, i.e. return a failure |
1563 | - $this->getLogger()->error('XML-RPC: ' . __METHOD__ . ': warning. Only Basic auth is supported by the current PHP/curl install'); |
|
1563 | + $this->getLogger()->error('XML-RPC: '.__METHOD__.': warning. Only Basic auth is supported by the current PHP/curl install'); |
|
1564 | 1564 | } |
1565 | 1565 | } |
1566 | 1566 | |
@@ -1603,14 +1603,14 @@ discard block |
||
1603 | 1603 | if ($proxyPort == 0) { |
1604 | 1604 | $proxyPort = 8080; // NB: even for HTTPS, local connection is on port 8080 |
1605 | 1605 | } |
1606 | - curl_setopt($curl, CURLOPT_PROXY, $proxyHost . ':' . $proxyPort); |
|
1606 | + curl_setopt($curl, CURLOPT_PROXY, $proxyHost.':'.$proxyPort); |
|
1607 | 1607 | if ($proxyUsername) { |
1608 | - curl_setopt($curl, CURLOPT_PROXYUSERPWD, $proxyUsername . ':' . $proxyPassword); |
|
1608 | + curl_setopt($curl, CURLOPT_PROXYUSERPWD, $proxyUsername.':'.$proxyPassword); |
|
1609 | 1609 | if (defined('CURLOPT_PROXYAUTH')) { |
1610 | 1610 | curl_setopt($curl, CURLOPT_PROXYAUTH, $proxyAuthType); |
1611 | 1611 | } elseif ($proxyAuthType != 1) { |
1612 | 1612 | /// @todo make this a proper error, i.e. return a failure |
1613 | - $this->getLogger()->error('XML-RPC: ' . __METHOD__ . ': warning. Only Basic auth to proxy is supported by the current PHP/curl install'); |
|
1613 | + $this->getLogger()->error('XML-RPC: '.__METHOD__.': warning. Only Basic auth to proxy is supported by the current PHP/curl install'); |
|
1614 | 1614 | } |
1615 | 1615 | } |
1616 | 1616 | } |
@@ -1620,7 +1620,7 @@ discard block |
||
1620 | 1620 | if (count($this->cookies)) { |
1621 | 1621 | $cookieHeader = ''; |
1622 | 1622 | foreach ($this->cookies as $name => $cookie) { |
1623 | - $cookieHeader .= $name . '=' . $cookie['value'] . '; '; |
|
1623 | + $cookieHeader .= $name.'='.$cookie['value'].'; '; |
|
1624 | 1624 | } |
1625 | 1625 | curl_setopt($curl, CURLOPT_COOKIE, substr($cookieHeader, 0, -2)); |
1626 | 1626 | } |
@@ -1629,7 +1629,7 @@ discard block |
||
1629 | 1629 | curl_setopt($curl, $opt, $val); |
1630 | 1630 | } |
1631 | 1631 | |
1632 | - if ($this->debug > 1) { |
|
1632 | + if ($this->debug>1) { |
|
1633 | 1633 | $this->getLogger()->debug("---SENDING---\n$payload\n---END---"); |
1634 | 1634 | } |
1635 | 1635 | |
@@ -1720,7 +1720,7 @@ discard block |
||
1720 | 1720 | $call['methodName'] = new Value($req->method(), 'string'); |
1721 | 1721 | $numParams = $req->getNumParams(); |
1722 | 1722 | $params = array(); |
1723 | - for ($i = 0; $i < $numParams; $i++) { |
|
1723 | + for ($i = 0; $i<$numParams; $i++) { |
|
1724 | 1724 | $params[$i] = $req->getParam($i); |
1725 | 1725 | } |
1726 | 1726 | $call['params'] = new Value($params, 'array'); |
@@ -1742,7 +1742,7 @@ discard block |
||
1742 | 1742 | $response = array(); |
1743 | 1743 | |
1744 | 1744 | if ($this->return_type == 'xml') { |
1745 | - for ($i = 0; $i < count($reqs); $i++) { |
|
1745 | + for ($i = 0; $i<count($reqs); $i++) { |
|
1746 | 1746 | $response[] = new Response($rets, 0, '', 'xml', $result->httpResponse()); |
1747 | 1747 | } |
1748 | 1748 | |
@@ -1750,21 +1750,21 @@ discard block |
||
1750 | 1750 | if (!is_array($rets)) { |
1751 | 1751 | // bad return type from system.multicall |
1752 | 1752 | return new Response(0, PhpXmlRpc::$xmlrpcerr['multicall_error'], |
1753 | - PhpXmlRpc::$xmlrpcstr['multicall_error'] . ': not an array', 'phpvals', $result->httpResponse()); |
|
1753 | + PhpXmlRpc::$xmlrpcstr['multicall_error'].': not an array', 'phpvals', $result->httpResponse()); |
|
1754 | 1754 | } |
1755 | 1755 | $numRets = count($rets); |
1756 | 1756 | if ($numRets != count($reqs)) { |
1757 | 1757 | // wrong number of return values. |
1758 | 1758 | return new Response(0, PhpXmlRpc::$xmlrpcerr['multicall_error'], |
1759 | - PhpXmlRpc::$xmlrpcstr['multicall_error'] . ': incorrect number of responses', 'phpvals', |
|
1759 | + PhpXmlRpc::$xmlrpcstr['multicall_error'].': incorrect number of responses', 'phpvals', |
|
1760 | 1760 | $result->httpResponse()); |
1761 | 1761 | } |
1762 | 1762 | |
1763 | - for ($i = 0; $i < $numRets; $i++) { |
|
1763 | + for ($i = 0; $i<$numRets; $i++) { |
|
1764 | 1764 | $val = $rets[$i]; |
1765 | 1765 | if (!is_array($val)) { |
1766 | 1766 | return new Response(0, PhpXmlRpc::$xmlrpcerr['multicall_error'], |
1767 | - PhpXmlRpc::$xmlrpcstr['multicall_error'] . ": response element $i is not an array or struct", |
|
1767 | + PhpXmlRpc::$xmlrpcstr['multicall_error'].": response element $i is not an array or struct", |
|
1768 | 1768 | 'phpvals', $result->httpResponse()); |
1769 | 1769 | } |
1770 | 1770 | switch (count($val)) { |
@@ -1772,7 +1772,7 @@ discard block |
||
1772 | 1772 | if (!isset($val[0])) { |
1773 | 1773 | // Bad value |
1774 | 1774 | return new Response(0, PhpXmlRpc::$xmlrpcerr['multicall_error'], |
1775 | - PhpXmlRpc::$xmlrpcstr['multicall_error'] . ": response element $i has no value", |
|
1775 | + PhpXmlRpc::$xmlrpcstr['multicall_error'].": response element $i has no value", |
|
1776 | 1776 | 'phpvals', $result->httpResponse()); |
1777 | 1777 | } |
1778 | 1778 | // Normal return value |
@@ -1784,20 +1784,20 @@ discard block |
||
1784 | 1784 | if (!is_int($code)) { |
1785 | 1785 | /// @todo should we check that it is != 0? |
1786 | 1786 | return new Response(0, PhpXmlRpc::$xmlrpcerr['multicall_error'], |
1787 | - PhpXmlRpc::$xmlrpcstr['multicall_error'] . ": response element $i has invalid or no faultCode", |
|
1787 | + PhpXmlRpc::$xmlrpcstr['multicall_error'].": response element $i has invalid or no faultCode", |
|
1788 | 1788 | 'phpvals', $result->httpResponse()); |
1789 | 1789 | } |
1790 | 1790 | $str = @$val['faultString']; |
1791 | 1791 | if (!is_string($str)) { |
1792 | 1792 | return new Response(0, PhpXmlRpc::$xmlrpcerr['multicall_error'], |
1793 | - PhpXmlRpc::$xmlrpcstr['multicall_error'] . ": response element $i has invalid or no FaultString", |
|
1793 | + PhpXmlRpc::$xmlrpcstr['multicall_error'].": response element $i has invalid or no FaultString", |
|
1794 | 1794 | 'phpvals', $result->httpResponse()); |
1795 | 1795 | } |
1796 | 1796 | $response[$i] = new Response(0, $code, $str, 'phpvals', $result->httpResponse()); |
1797 | 1797 | break; |
1798 | 1798 | default: |
1799 | 1799 | return new Response(0, PhpXmlRpc::$xmlrpcerr['multicall_error'], |
1800 | - PhpXmlRpc::$xmlrpcstr['multicall_error'] . ": response element $i has too many items", |
|
1800 | + PhpXmlRpc::$xmlrpcstr['multicall_error'].": response element $i has too many items", |
|
1801 | 1801 | 'phpvals', $result->httpResponse()); |
1802 | 1802 | } |
1803 | 1803 | } |
@@ -1806,14 +1806,14 @@ discard block |
||
1806 | 1806 | // return type == 'xmlrpcvals' |
1807 | 1807 | if ($rets->kindOf() != 'array') { |
1808 | 1808 | return new Response(0, PhpXmlRpc::$xmlrpcerr['multicall_error'], |
1809 | - PhpXmlRpc::$xmlrpcstr['multicall_error'] . ": response element $i is not an array", 'xmlrpcvals', |
|
1809 | + PhpXmlRpc::$xmlrpcstr['multicall_error'].": response element $i is not an array", 'xmlrpcvals', |
|
1810 | 1810 | $result->httpResponse()); |
1811 | 1811 | } |
1812 | 1812 | $numRets = $rets->count(); |
1813 | 1813 | if ($numRets != count($reqs)) { |
1814 | 1814 | // wrong number of return values. |
1815 | 1815 | return new Response(0, PhpXmlRpc::$xmlrpcerr['multicall_error'], |
1816 | - PhpXmlRpc::$xmlrpcstr['multicall_error'] . ': incorrect number of responses', 'xmlrpcvals', |
|
1816 | + PhpXmlRpc::$xmlrpcstr['multicall_error'].': incorrect number of responses', 'xmlrpcvals', |
|
1817 | 1817 | $result->httpResponse()); |
1818 | 1818 | } |
1819 | 1819 | |
@@ -1822,7 +1822,7 @@ discard block |
||
1822 | 1822 | case 'array': |
1823 | 1823 | if ($val->count() != 1) { |
1824 | 1824 | return new Response(0, PhpXmlRpc::$xmlrpcerr['multicall_error'], |
1825 | - PhpXmlRpc::$xmlrpcstr['multicall_error'] . ": response element $i has too many items", |
|
1825 | + PhpXmlRpc::$xmlrpcstr['multicall_error'].": response element $i has too many items", |
|
1826 | 1826 | 'phpvals', $result->httpResponse()); |
1827 | 1827 | } |
1828 | 1828 | // Normal return value |
@@ -1831,28 +1831,28 @@ discard block |
||
1831 | 1831 | case 'struct': |
1832 | 1832 | if ($val->count() != 2) { |
1833 | 1833 | return new Response(0, PhpXmlRpc::$xmlrpcerr['multicall_error'], |
1834 | - PhpXmlRpc::$xmlrpcstr['multicall_error'] . ": response element $i has too many items", |
|
1834 | + PhpXmlRpc::$xmlrpcstr['multicall_error'].": response element $i has too many items", |
|
1835 | 1835 | 'phpvals', $result->httpResponse()); |
1836 | 1836 | } |
1837 | 1837 | /** @var Value $code */ |
1838 | 1838 | $code = $val['faultCode']; |
1839 | 1839 | if ($code->kindOf() != 'scalar' || $code->scalarTyp() != 'int') { |
1840 | 1840 | return new Response(0, PhpXmlRpc::$xmlrpcerr['multicall_error'], |
1841 | - PhpXmlRpc::$xmlrpcstr['multicall_error'] . ": response element $i has invalid or no faultCode", |
|
1841 | + PhpXmlRpc::$xmlrpcstr['multicall_error'].": response element $i has invalid or no faultCode", |
|
1842 | 1842 | 'xmlrpcvals', $result->httpResponse()); |
1843 | 1843 | } |
1844 | 1844 | /** @var Value $str */ |
1845 | 1845 | $str = $val['faultString']; |
1846 | 1846 | if ($str->kindOf() != 'scalar' || $str->scalarTyp() != 'string') { |
1847 | 1847 | return new Response(0, PhpXmlRpc::$xmlrpcerr['multicall_error'], |
1848 | - PhpXmlRpc::$xmlrpcstr['multicall_error'] . ": response element $i has invalid or no faultCode", |
|
1848 | + PhpXmlRpc::$xmlrpcstr['multicall_error'].": response element $i has invalid or no faultCode", |
|
1849 | 1849 | 'xmlrpcvals', $result->httpResponse()); |
1850 | 1850 | } |
1851 | 1851 | $response[] = new Response(0, $code->scalarVal(), $str->scalarVal(), 'xmlrpcvals', $result->httpResponse()); |
1852 | 1852 | break; |
1853 | 1853 | default: |
1854 | 1854 | return new Response(0, PhpXmlRpc::$xmlrpcerr['multicall_error'], |
1855 | - PhpXmlRpc::$xmlrpcstr['multicall_error'] . ": response element $i is not an array or struct", |
|
1855 | + PhpXmlRpc::$xmlrpcstr['multicall_error'].": response element $i is not an array or struct", |
|
1856 | 1856 | 'xmlrpcvals', $result->httpResponse()); |
1857 | 1857 | } |
1858 | 1858 | } |
@@ -183,12 +183,12 @@ discard block |
||
183 | 183 | // q: can php be built without ctype? should we use a regexp? |
184 | 184 | if (is_string($key) && !ctype_digit($key)) { |
185 | 185 | /// @todo on invalid options, throw/error-out instead of logging an error message? |
186 | - switch($key) { |
|
186 | + switch ($key) { |
|
187 | 187 | case 'target_charset': |
188 | 188 | if (function_exists('mb_convert_encoding')) { |
189 | 189 | $this->current_parsing_options['target_charset'] = $val; |
190 | 190 | } else { |
191 | - $this->getLogger()->error('XML-RPC: ' . __METHOD__ . ": 'target_charset' option is unsupported without mbstring"); |
|
191 | + $this->getLogger()->error('XML-RPC: '.__METHOD__.": 'target_charset' option is unsupported without mbstring"); |
|
192 | 192 | } |
193 | 193 | break; |
194 | 194 | |
@@ -196,7 +196,7 @@ discard block |
||
196 | 196 | if (is_callable($val)) { |
197 | 197 | $this->current_parsing_options['methodname_callback'] = $val; |
198 | 198 | } else { |
199 | - $this->getLogger()->error('XML-RPC: ' . __METHOD__ . ": Callback passed as 'methodname_callback' is not callable"); |
|
199 | + $this->getLogger()->error('XML-RPC: '.__METHOD__.": Callback passed as 'methodname_callback' is not callable"); |
|
200 | 200 | } |
201 | 201 | break; |
202 | 202 | |
@@ -207,7 +207,7 @@ discard block |
||
207 | 207 | break; |
208 | 208 | |
209 | 209 | default: |
210 | - $this->getLogger()->error('XML-RPC: ' . __METHOD__ . ": unsupported option: $key"); |
|
210 | + $this->getLogger()->error('XML-RPC: '.__METHOD__.": unsupported option: $key"); |
|
211 | 211 | } |
212 | 212 | unset($mergedOptions[$key]); |
213 | 213 | } |
@@ -253,10 +253,10 @@ discard block |
||
253 | 253 | |
254 | 254 | try { |
255 | 255 | // @see ticket #70 - we have to parse big xml docs in chunks to avoid errors |
256 | - for ($offset = 0; $offset < $len; $offset += $this->maxChunkLength) { |
|
256 | + for ($offset = 0; $offset<$len; $offset += $this->maxChunkLength) { |
|
257 | 257 | $chunk = substr($data, $offset, $this->maxChunkLength); |
258 | 258 | // error handling: xml not well formed |
259 | - if (!xml_parse($parser, $chunk, $offset + $this->maxChunkLength >= $len)) { |
|
259 | + if (!xml_parse($parser, $chunk, $offset+$this->maxChunkLength>=$len)) { |
|
260 | 260 | $errCode = xml_get_error_code($parser); |
261 | 261 | $errStr = sprintf('XML error %s: %s at line %d, column %d', $errCode, xml_error_string($errCode), |
262 | 262 | xml_get_current_line_number($parser), xml_get_current_column_number($parser)); |
@@ -265,7 +265,7 @@ discard block |
||
265 | 265 | $this->_xh['isf_reason'] = $errStr; |
266 | 266 | } |
267 | 267 | // no need to parse further if we already have a fatal error |
268 | - if ($this->_xh['isf'] >= 2) { |
|
268 | + if ($this->_xh['isf']>=2) { |
|
269 | 269 | break; |
270 | 270 | } |
271 | 271 | } |
@@ -303,7 +303,7 @@ discard block |
||
303 | 303 | public function xmlrpc_se($parser, $name, $attrs, $acceptSingleVals = false) |
304 | 304 | { |
305 | 305 | // if invalid xml-rpc already detected, skip all processing |
306 | - if ($this->_xh['isf'] >= 2) { |
|
306 | + if ($this->_xh['isf']>=2) { |
|
307 | 307 | return; |
308 | 308 | } |
309 | 309 | |
@@ -317,7 +317,7 @@ discard block |
||
317 | 317 | if ($acceptSingleVals === false) { |
318 | 318 | $accept = $this->current_parsing_options['accept']; |
319 | 319 | } else { |
320 | - $this->logDeprecation('Using argument $acceptSingleVals for method ' . __METHOD__ . ' is deprecated'); |
|
320 | + $this->logDeprecation('Using argument $acceptSingleVals for method '.__METHOD__.' is deprecated'); |
|
321 | 321 | $accept = self::ACCEPT_REQUEST | self::ACCEPT_RESPONSE | self::ACCEPT_VALUE; |
322 | 322 | } |
323 | 323 | if (($name == 'METHODCALL' && ($accept & self::ACCEPT_REQUEST)) || |
@@ -327,7 +327,7 @@ discard block |
||
327 | 327 | $this->_xh['rt'] = strtolower($name); |
328 | 328 | } else { |
329 | 329 | $this->_xh['isf'] = 2; |
330 | - $this->_xh['isf_reason'] = 'missing top level xmlrpc element. Found: ' . $name; |
|
330 | + $this->_xh['isf_reason'] = 'missing top level xmlrpc element. Found: '.$name; |
|
331 | 331 | |
332 | 332 | return; |
333 | 333 | } |
@@ -429,7 +429,7 @@ discard block |
||
429 | 429 | |
430 | 430 | case 'MEMBER': |
431 | 431 | // set member name to null, in case we do not find in the xml later on |
432 | - $this->_xh['valuestack'][count($this->_xh['valuestack']) - 1]['name'] = null; |
|
432 | + $this->_xh['valuestack'][count($this->_xh['valuestack'])-1]['name'] = null; |
|
433 | 433 | //$this->_xh['ac']=''; |
434 | 434 | // Drop trough intentionally |
435 | 435 | |
@@ -510,7 +510,7 @@ discard block |
||
510 | 510 | */ |
511 | 511 | public function xmlrpc_ee($parser, $name, $rebuildXmlrpcvals = 1) |
512 | 512 | { |
513 | - if ($this->_xh['isf'] >= 2) { |
|
513 | + if ($this->_xh['isf']>=2) { |
|
514 | 514 | return; |
515 | 515 | } |
516 | 516 | |
@@ -532,7 +532,7 @@ discard block |
||
532 | 532 | $this->_xh['value'] = mb_convert_encoding($this->_xh['value'], $this->current_parsing_options['target_charset'], 'UTF-8'); |
533 | 533 | } |
534 | 534 | |
535 | - if ($rebuildXmlrpcvals > 0) { |
|
535 | + if ($rebuildXmlrpcvals>0) { |
|
536 | 536 | // build the xml-rpc val out of the data received, and substitute it |
537 | 537 | $temp = new Value($this->_xh['value'], $this->_xh['vt']); |
538 | 538 | // in case we got info about underlying php class, save it in the object we're rebuilding |
@@ -540,15 +540,15 @@ discard block |
||
540 | 540 | $temp->_php_class = $this->_xh['php_class']; |
541 | 541 | } |
542 | 542 | $this->_xh['value'] = $temp; |
543 | - } elseif ($rebuildXmlrpcvals < 0) { |
|
543 | + } elseif ($rebuildXmlrpcvals<0) { |
|
544 | 544 | if ($this->_xh['vt'] == Value::$xmlrpcDateTime) { |
545 | - $this->_xh['value'] = (object)array( |
|
545 | + $this->_xh['value'] = (object) array( |
|
546 | 546 | 'xmlrpc_type' => 'datetime', |
547 | 547 | 'scalar' => $this->_xh['value'], |
548 | 548 | 'timestamp' => \PhpXmlRpc\Helper\Date::iso8601Decode($this->_xh['value']) |
549 | 549 | ); |
550 | 550 | } elseif ($this->_xh['vt'] == Value::$xmlrpcBase64) { |
551 | - $this->_xh['value'] = (object)array( |
|
551 | + $this->_xh['value'] = (object) array( |
|
552 | 552 | 'xmlrpc_type' => 'base64', |
553 | 553 | 'scalar' => $this->_xh['value'] |
554 | 554 | ); |
@@ -563,8 +563,8 @@ discard block |
||
563 | 563 | // check if we are inside an array or struct: |
564 | 564 | // if value just built is inside an array, let's move it into array on the stack |
565 | 565 | $vscount = count($this->_xh['valuestack']); |
566 | - if ($vscount && $this->_xh['valuestack'][$vscount - 1]['type'] == 'ARRAY') { |
|
567 | - $this->_xh['valuestack'][$vscount - 1]['values'][] = $this->_xh['value']; |
|
566 | + if ($vscount && $this->_xh['valuestack'][$vscount-1]['type'] == 'ARRAY') { |
|
567 | + $this->_xh['valuestack'][$vscount-1]['values'][] = $this->_xh['value']; |
|
568 | 568 | } |
569 | 569 | break; |
570 | 570 | |
@@ -591,7 +591,7 @@ discard block |
||
591 | 591 | // log if receiving something strange, even though we set the value to false anyway |
592 | 592 | /// @todo to be consistent with the other types, we should return a value outside the good-value domain, e.g. NULL |
593 | 593 | if ($this->_xh['ac'] != '0' && strcasecmp($this->_xh['ac'], 'false') !== 0) { |
594 | - if (!$this->handleParsingError('invalid data received in BOOLEAN value: ' . |
|
594 | + if (!$this->handleParsingError('invalid data received in BOOLEAN value: '. |
|
595 | 595 | $this->truncateValueForLog($this->_xh['ac']), __METHOD__)) { |
596 | 596 | return; |
597 | 597 | } |
@@ -611,7 +611,7 @@ discard block |
||
611 | 611 | $this->_xh['vt'] = strtolower($name); |
612 | 612 | $this->_xh['lv'] = 3; // indicate we've found a value |
613 | 613 | if (!preg_match(PhpXmlRpc::$xmlrpc_int_format, $this->_xh['ac'])) { |
614 | - if (!$this->handleParsingError('non numeric data received in INT value: ' . |
|
614 | + if (!$this->handleParsingError('non numeric data received in INT value: '. |
|
615 | 615 | $this->truncateValueForLog($this->_xh['ac']), __METHOD__)) { |
616 | 616 | return; |
617 | 617 | } |
@@ -619,7 +619,7 @@ discard block |
||
619 | 619 | $this->_xh['value'] = 'ERROR_NON_NUMERIC_FOUND'; |
620 | 620 | } else { |
621 | 621 | // it's ok, add it on |
622 | - $this->_xh['value'] = (int)$this->_xh['ac']; |
|
622 | + $this->_xh['value'] = (int) $this->_xh['ac']; |
|
623 | 623 | } |
624 | 624 | break; |
625 | 625 | |
@@ -627,7 +627,7 @@ discard block |
||
627 | 627 | $this->_xh['vt'] = Value::$xmlrpcDouble; |
628 | 628 | $this->_xh['lv'] = 3; // indicate we've found a value |
629 | 629 | if (!preg_match(PhpXmlRpc::$xmlrpc_double_format, $this->_xh['ac'])) { |
630 | - if (!$this->handleParsingError('non numeric data received in DOUBLE value: ' . |
|
630 | + if (!$this->handleParsingError('non numeric data received in DOUBLE value: '. |
|
631 | 631 | $this->truncateValueForLog($this->_xh['ac']), __METHOD__)) { |
632 | 632 | return; |
633 | 633 | } |
@@ -635,7 +635,7 @@ discard block |
||
635 | 635 | $this->_xh['value'] = 'ERROR_NON_NUMERIC_FOUND'; |
636 | 636 | } else { |
637 | 637 | // it's ok, add it on |
638 | - $this->_xh['value'] = (double)$this->_xh['ac']; |
|
638 | + $this->_xh['value'] = (double) $this->_xh['ac']; |
|
639 | 639 | } |
640 | 640 | break; |
641 | 641 | |
@@ -643,7 +643,7 @@ discard block |
||
643 | 643 | $this->_xh['vt'] = Value::$xmlrpcDateTime; |
644 | 644 | $this->_xh['lv'] = 3; // indicate we've found a value |
645 | 645 | if (!preg_match(PhpXmlRpc::$xmlrpc_datetime_format, $this->_xh['ac'])) { |
646 | - if (!$this->handleParsingError('invalid data received in DATETIME value: ' . |
|
646 | + if (!$this->handleParsingError('invalid data received in DATETIME value: '. |
|
647 | 647 | $this->truncateValueForLog($this->_xh['ac']), __METHOD__)) { |
648 | 648 | return; |
649 | 649 | } |
@@ -654,9 +654,9 @@ discard block |
||
654 | 654 | |
655 | 655 | // the default regex used to validate the date string a few lines above should make this case impossible, |
656 | 656 | // but one never knows... |
657 | - } catch(\Exception $e) { |
|
657 | + } catch (\Exception $e) { |
|
658 | 658 | // what to do? We can not guarantee that a valid date can be created. We return null... |
659 | - if (!$this->handleParsingError('invalid data received in DATETIME value. Error ' . |
|
659 | + if (!$this->handleParsingError('invalid data received in DATETIME value. Error '. |
|
660 | 660 | $e->getMessage(), __METHOD__)) { |
661 | 661 | return; |
662 | 662 | } |
@@ -673,14 +673,14 @@ discard block |
||
673 | 673 | $v = base64_decode($this->_xh['ac'], true); |
674 | 674 | if ($v === false) { |
675 | 675 | $this->_xh['isf'] = 2; |
676 | - $this->_xh['isf_reason'] = 'Invalid data received in BASE64 value: '. $this->truncateValueForLog($this->_xh['ac']); |
|
676 | + $this->_xh['isf_reason'] = 'Invalid data received in BASE64 value: '.$this->truncateValueForLog($this->_xh['ac']); |
|
677 | 677 | return; |
678 | 678 | } |
679 | 679 | } else { |
680 | 680 | $v = base64_decode($this->_xh['ac']); |
681 | 681 | if ($v === '' && $this->_xh['ac'] !== '') { |
682 | 682 | // only the empty string should decode to the empty string |
683 | - $this->getLogger()->error('XML-RPC: ' . __METHOD__ . ': invalid data received in BASE64 value: ' . |
|
683 | + $this->getLogger()->error('XML-RPC: '.__METHOD__.': invalid data received in BASE64 value: '. |
|
684 | 684 | $this->truncateValueForLog($this->_xh['ac'])); |
685 | 685 | } |
686 | 686 | } |
@@ -688,20 +688,20 @@ discard block |
||
688 | 688 | break; |
689 | 689 | |
690 | 690 | case 'NAME': |
691 | - $this->_xh['valuestack'][count($this->_xh['valuestack']) - 1]['name'] = $this->_xh['ac']; |
|
691 | + $this->_xh['valuestack'][count($this->_xh['valuestack'])-1]['name'] = $this->_xh['ac']; |
|
692 | 692 | break; |
693 | 693 | |
694 | 694 | case 'MEMBER': |
695 | 695 | // add to array in the stack the last element built, unless no VALUE or no NAME were found |
696 | 696 | if ($this->_xh['vt']) { |
697 | 697 | $vscount = count($this->_xh['valuestack']); |
698 | - if ($this->_xh['valuestack'][$vscount - 1]['name'] === null) { |
|
698 | + if ($this->_xh['valuestack'][$vscount-1]['name'] === null) { |
|
699 | 699 | if (!$this->handleParsingError('missing NAME inside STRUCT in received xml', __METHOD__)) { |
700 | 700 | return; |
701 | 701 | } |
702 | - $this->_xh['valuestack'][$vscount - 1]['name'] = ''; |
|
702 | + $this->_xh['valuestack'][$vscount-1]['name'] = ''; |
|
703 | 703 | } |
704 | - $this->_xh['valuestack'][$vscount - 1]['values'][$this->_xh['valuestack'][$vscount - 1]['name']] = $this->_xh['value']; |
|
704 | + $this->_xh['valuestack'][$vscount-1]['values'][$this->_xh['valuestack'][$vscount-1]['name']] = $this->_xh['value']; |
|
705 | 705 | } else { |
706 | 706 | if (!$this->handleParsingError('missing VALUE inside STRUCT in received xml', __METHOD__)) { |
707 | 707 | return; |
@@ -817,7 +817,7 @@ discard block |
||
817 | 817 | public function xmlrpc_cd($parser, $data) |
818 | 818 | { |
819 | 819 | // skip processing if xml fault already detected |
820 | - if ($this->_xh['isf'] >= 2) { |
|
820 | + if ($this->_xh['isf']>=2) { |
|
821 | 821 | return; |
822 | 822 | } |
823 | 823 | |
@@ -839,7 +839,7 @@ discard block |
||
839 | 839 | public function xmlrpc_dh($parser, $data) |
840 | 840 | { |
841 | 841 | // skip processing if xml fault already detected |
842 | - if ($this->_xh['isf'] >= 2) { |
|
842 | + if ($this->_xh['isf']>=2) { |
|
843 | 843 | return; |
844 | 844 | } |
845 | 845 | |
@@ -913,8 +913,8 @@ discard block |
||
913 | 913 | // Details: |
914 | 914 | // SPACE: (#x20 | #x9 | #xD | #xA)+ === [ \x9\xD\xA]+ |
915 | 915 | // EQ: SPACE?=SPACE? === [ \x9\xD\xA]*=[ \x9\xD\xA]* |
916 | - if (preg_match('/^<\?xml\s+version\s*=\s*' . "((?:\"[a-zA-Z0-9_.:-]+\")|(?:'[a-zA-Z0-9_.:-]+'))" . |
|
917 | - '\s+encoding\s*=\s*' . "((?:\"[A-Za-z][A-Za-z0-9._-]*\")|(?:'[A-Za-z][A-Za-z0-9._-]*'))/", |
|
916 | + if (preg_match('/^<\?xml\s+version\s*=\s*'."((?:\"[a-zA-Z0-9_.:-]+\")|(?:'[a-zA-Z0-9_.:-]+'))". |
|
917 | + '\s+encoding\s*=\s*'."((?:\"[A-Za-z][A-Za-z0-9._-]*\")|(?:'[A-Za-z][A-Za-z0-9._-]*'))/", |
|
918 | 918 | $xmlChunk, $matches)) { |
919 | 919 | return strtoupper(substr($matches[2], 1, -1)); |
920 | 920 | } |
@@ -932,7 +932,7 @@ discard block |
||
932 | 932 | // NB: mb_detect likes to call it ascii, xml parser likes to call it US_ASCII... |
933 | 933 | // IANA also likes better US-ASCII, so go with it |
934 | 934 | if ($enc == 'ASCII') { |
935 | - $enc = 'US-' . $enc; |
|
935 | + $enc = 'US-'.$enc; |
|
936 | 936 | } |
937 | 937 | |
938 | 938 | return $enc; |
@@ -969,8 +969,8 @@ discard block |
||
969 | 969 | // Details: |
970 | 970 | // SPACE: (#x20 | #x9 | #xD | #xA)+ === [ \x9\xD\xA]+ |
971 | 971 | // EQ: SPACE?=SPACE? === [ \x9\xD\xA]*=[ \x9\xD\xA]* |
972 | - if (preg_match('/^<\?xml\s+version\s*=\s*' . "((?:\"[a-zA-Z0-9_.:-]+\")|(?:'[a-zA-Z0-9_.:-]+'))" . |
|
973 | - '\s+encoding\s*=\s*' . "((?:\"[A-Za-z][A-Za-z0-9._-]*\")|(?:'[A-Za-z][A-Za-z0-9._-]*'))/", |
|
972 | + if (preg_match('/^<\?xml\s+version\s*=\s*'."((?:\"[a-zA-Z0-9_.:-]+\")|(?:'[a-zA-Z0-9_.:-]+'))". |
|
973 | + '\s+encoding\s*=\s*'."((?:\"[A-Za-z][A-Za-z0-9._-]*\")|(?:'[A-Za-z][A-Za-z0-9._-]*'))/", |
|
974 | 974 | $xmlChunk)) { |
975 | 975 | return true; |
976 | 976 | } |
@@ -990,7 +990,7 @@ discard block |
||
990 | 990 | $this->_xh['isf_reason'] = ucfirst($message); |
991 | 991 | return false; |
992 | 992 | } else { |
993 | - $this->getLogger()->error('XML-RPC: ' . ($method != '' ? $method . ': ' : '') . $message); |
|
993 | + $this->getLogger()->error('XML-RPC: '.($method != '' ? $method.': ' : '').$message); |
|
994 | 994 | return true; |
995 | 995 | } |
996 | 996 | } |
@@ -1002,8 +1002,8 @@ discard block |
||
1002 | 1002 | */ |
1003 | 1003 | protected function truncateValueForLog($data) |
1004 | 1004 | { |
1005 | - if (strlen($data) > $this->maxLogValueLength) { |
|
1006 | - return substr($data, 0, $this->maxLogValueLength - 3) . '...'; |
|
1005 | + if (strlen($data)>$this->maxLogValueLength) { |
|
1006 | + return substr($data, 0, $this->maxLogValueLength-3).'...'; |
|
1007 | 1007 | } |
1008 | 1008 | |
1009 | 1009 | return $data; |
@@ -1016,13 +1016,13 @@ discard block |
||
1016 | 1016 | switch ($name) { |
1017 | 1017 | // this should only ever be called by subclasses which overtook `parse()` |
1018 | 1018 | case 'accept': |
1019 | - $this->logDeprecation('Setting property XMLParser::' . $name . ' is deprecated'); |
|
1019 | + $this->logDeprecation('Setting property XMLParser::'.$name.' is deprecated'); |
|
1020 | 1020 | $this->current_parsing_options['accept'] = $value; |
1021 | 1021 | break; |
1022 | 1022 | default: |
1023 | 1023 | /// @todo throw instead? There are very few other places where the lib trigger errors which can potentially reach stdout... |
1024 | 1024 | $trace = debug_backtrace(DEBUG_BACKTRACE_IGNORE_ARGS); |
1025 | - trigger_error('Undefined property via __set(): ' . $name . ' in ' . $trace[0]['file'] . ' on line ' . $trace[0]['line'], E_USER_WARNING); |
|
1025 | + trigger_error('Undefined property via __set(): '.$name.' in '.$trace[0]['file'].' on line '.$trace[0]['line'], E_USER_WARNING); |
|
1026 | 1026 | } |
1027 | 1027 | } |
1028 | 1028 | |
@@ -1030,7 +1030,7 @@ discard block |
||
1030 | 1030 | { |
1031 | 1031 | switch ($name) { |
1032 | 1032 | case 'accept': |
1033 | - $this->logDeprecation('Checking property XMLParser::' . $name . ' is deprecated'); |
|
1033 | + $this->logDeprecation('Checking property XMLParser::'.$name.' is deprecated'); |
|
1034 | 1034 | return isset($this->current_parsing_options['accept']); |
1035 | 1035 | default: |
1036 | 1036 | return false; |
@@ -1042,13 +1042,13 @@ discard block |
||
1042 | 1042 | switch ($name) { |
1043 | 1043 | // q: does this make sense at all? |
1044 | 1044 | case 'accept': |
1045 | - $this->logDeprecation('Unsetting property XMLParser::' . $name . ' is deprecated'); |
|
1045 | + $this->logDeprecation('Unsetting property XMLParser::'.$name.' is deprecated'); |
|
1046 | 1046 | unset($this->current_parsing_options['accept']); |
1047 | 1047 | break; |
1048 | 1048 | default: |
1049 | 1049 | /// @todo throw instead? There are very few other places where the lib trigger errors which can potentially reach stdout... |
1050 | 1050 | $trace = debug_backtrace(DEBUG_BACKTRACE_IGNORE_ARGS); |
1051 | - trigger_error('Undefined property via __unset(): ' . $name . ' in ' . $trace[0]['file'] . ' on line ' . $trace[0]['line'], E_USER_WARNING); |
|
1051 | + trigger_error('Undefined property via __unset(): '.$name.' in '.$trace[0]['file'].' on line '.$trace[0]['line'], E_USER_WARNING); |
|
1052 | 1052 | } |
1053 | 1053 | } |
1054 | 1054 | } |
@@ -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 | |
@@ -32,7 +32,7 @@ discard block |
||
32 | 32 | |
33 | 33 | protected function tear_down() |
34 | 34 | { |
35 | - if ($this->args['DEBUG'] > 0) { |
|
35 | + if ($this->args['DEBUG']>0) { |
|
36 | 36 | return; |
37 | 37 | } |
38 | 38 | |
@@ -50,16 +50,16 @@ discard block |
||
50 | 50 | |
51 | 51 | public function debug($message, $context = array()) |
52 | 52 | { |
53 | - $this->buffer .= $message . "\n"; |
|
53 | + $this->buffer .= $message."\n"; |
|
54 | 54 | } |
55 | 55 | |
56 | 56 | public function error($message, $context = array()) |
57 | 57 | { |
58 | - $this->buffer .= $message . "\n"; |
|
58 | + $this->buffer .= $message."\n"; |
|
59 | 59 | } |
60 | 60 | |
61 | 61 | public function warning($message, $context = array()) |
62 | 62 | { |
63 | - $this->buffer .= $message . "\n"; |
|
63 | + $this->buffer .= $message."\n"; |
|
64 | 64 | } |
65 | 65 | } |