@@ -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 | |
@@ -902,12 +902,12 @@ discard block |
||
902 | 902 | */ |
903 | 903 | public function getUrl() |
904 | 904 | { |
905 | - $url = $this->method . '://' . $this->server; |
|
905 | + $url = $this->method.'://'.$this->server; |
|
906 | 906 | if (($this->port = 80 && in_array($this->method, array('http', 'http10', 'http11', 'h2c'))) && |
907 | 907 | ($this->port = 443 && in_array($this->method, array('https', 'h2')))) { |
908 | - return $url . $this->path; |
|
908 | + return $url.$this->path; |
|
909 | 909 | } else { |
910 | - return $url . ':' . $this->port . $this->path; |
|
910 | + return $url.':'.$this->port.$this->path; |
|
911 | 911 | } |
912 | 912 | } |
913 | 913 | |
@@ -947,7 +947,7 @@ discard block |
||
947 | 947 | public function send($req, $timeout = 0, $method = '') |
948 | 948 | { |
949 | 949 | if ($method !== '' || $timeout !== 0) { |
950 | - $this->logDeprecation("Using non-default values for arguments 'method' and 'timeout' when calling method " . __METHOD__ . ' is deprecated'); |
|
950 | + $this->logDeprecation("Using non-default values for arguments 'method' and 'timeout' when calling method ".__METHOD__.' is deprecated'); |
|
951 | 951 | } |
952 | 952 | |
953 | 953 | // if user does not specify http protocol, use native method of this client |
@@ -1052,9 +1052,9 @@ discard block |
||
1052 | 1052 | */ |
1053 | 1053 | protected function sendPayloadHTTP10($req, $server, $port, $timeout = 0, $username = '', $password = '', |
1054 | 1054 | $authType = 1, $proxyHost = '', $proxyPort = 0, $proxyUsername = '', $proxyPassword = '', $proxyAuthType = 1, |
1055 | - $method='http') |
|
1055 | + $method = 'http') |
|
1056 | 1056 | { |
1057 | - $this->logDeprecation('Method ' . __METHOD__ . ' is deprecated'); |
|
1057 | + $this->logDeprecation('Method '.__METHOD__.' is deprecated'); |
|
1058 | 1058 | |
1059 | 1059 | return $this->sendPayloadSocket($req, $server, $port, $timeout, $username, $password, $authType, null, null, |
1060 | 1060 | null, null, $proxyHost, $proxyPort, $proxyUsername, $proxyPassword, $proxyAuthType, $method); |
@@ -1085,12 +1085,12 @@ discard block |
||
1085 | 1085 | * @param int $sslVersion |
1086 | 1086 | * @return Response |
1087 | 1087 | */ |
1088 | - protected function sendPayloadHTTPS($req, $server, $port, $timeout = 0, $username = '', $password = '', |
|
1088 | + protected function sendPayloadHTTPS($req, $server, $port, $timeout = 0, $username = '', $password = '', |
|
1089 | 1089 | $authType = 1, $cert = '', $certPass = '', $caCert = '', $caCertDir = '', $proxyHost = '', $proxyPort = 0, |
1090 | 1090 | $proxyUsername = '', $proxyPassword = '', $proxyAuthType = 1, $keepAlive = false, $key = '', $keyPass = '', |
1091 | 1091 | $sslVersion = 0) |
1092 | 1092 | { |
1093 | - $this->logDeprecation('Method ' . __METHOD__ . ' is deprecated'); |
|
1093 | + $this->logDeprecation('Method '.__METHOD__.' is deprecated'); |
|
1094 | 1094 | |
1095 | 1095 | return $this->sendPayloadCURL($req, $server, $port, $timeout, $username, |
1096 | 1096 | $password, $authType, $cert, $certPass, $caCert, $caCertDir, $proxyHost, $proxyPort, |
@@ -1124,7 +1124,7 @@ discard block |
||
1124 | 1124 | */ |
1125 | 1125 | protected function sendPayloadSocket($req, $server, $port, $timeout = 0, $username = '', $password = '', |
1126 | 1126 | $authType = 1, $cert = '', $certPass = '', $caCert = '', $caCertDir = '', $proxyHost = '', $proxyPort = 0, |
1127 | - $proxyUsername = '', $proxyPassword = '', $proxyAuthType = 1, $method='http', $key = '', $keyPass = '', |
|
1127 | + $proxyUsername = '', $proxyPassword = '', $proxyAuthType = 1, $method = 'http', $key = '', $keyPass = '', |
|
1128 | 1128 | $sslVersion = 0) |
1129 | 1129 | { |
1130 | 1130 | /// @todo log a warning if passed an unsupported method |
@@ -1157,16 +1157,16 @@ discard block |
||
1157 | 1157 | // thanks to Grant Rauscher <[email protected]> for this |
1158 | 1158 | $credentials = ''; |
1159 | 1159 | if ($username != '') { |
1160 | - $credentials = 'Authorization: Basic ' . base64_encode($username . ':' . $password) . "\r\n"; |
|
1160 | + $credentials = 'Authorization: Basic '.base64_encode($username.':'.$password)."\r\n"; |
|
1161 | 1161 | if ($authType != 1) { |
1162 | 1162 | /// @todo make this a proper error, i.e. return a failure |
1163 | - $this->getLogger()->error('XML-RPC: ' . __METHOD__ . ': warning. Only Basic auth is supported with HTTP 1.0'); |
|
1163 | + $this->getLogger()->error('XML-RPC: '.__METHOD__.': warning. Only Basic auth is supported with HTTP 1.0'); |
|
1164 | 1164 | } |
1165 | 1165 | } |
1166 | 1166 | |
1167 | 1167 | $acceptedEncoding = ''; |
1168 | 1168 | if (is_array($this->accepted_compression) && count($this->accepted_compression)) { |
1169 | - $acceptedEncoding = 'Accept-Encoding: ' . implode(', ', $this->accepted_compression) . "\r\n"; |
|
1169 | + $acceptedEncoding = 'Accept-Encoding: '.implode(', ', $this->accepted_compression)."\r\n"; |
|
1170 | 1170 | } |
1171 | 1171 | |
1172 | 1172 | if ($port == 0) { |
@@ -1182,13 +1182,13 @@ discard block |
||
1182 | 1182 | $connectPort = $proxyPort; |
1183 | 1183 | $transport = 'tcp'; |
1184 | 1184 | /// @todo check: should we not use https in some cases? |
1185 | - $uri = 'http://' . $server . ':' . $port . $this->path; |
|
1185 | + $uri = 'http://'.$server.':'.$port.$this->path; |
|
1186 | 1186 | if ($proxyUsername != '') { |
1187 | 1187 | if ($proxyAuthType != 1) { |
1188 | 1188 | /// @todo make this a proper error, i.e. return a failure |
1189 | - $this->getLogger()->error('XML-RPC: ' . __METHOD__ . ': warning. Only Basic auth to proxy is supported with HTTP 1.0'); |
|
1189 | + $this->getLogger()->error('XML-RPC: '.__METHOD__.': warning. Only Basic auth to proxy is supported with HTTP 1.0'); |
|
1190 | 1190 | } |
1191 | - $proxyCredentials = 'Proxy-Authorization: Basic ' . base64_encode($proxyUsername . ':' . $proxyPassword) . "\r\n"; |
|
1191 | + $proxyCredentials = 'Proxy-Authorization: Basic '.base64_encode($proxyUsername.':'.$proxyPassword)."\r\n"; |
|
1192 | 1192 | } |
1193 | 1193 | } else { |
1194 | 1194 | $connectServer = $server; |
@@ -1203,32 +1203,32 @@ discard block |
||
1203 | 1203 | $version = ''; |
1204 | 1204 | foreach ($this->cookies as $name => $cookie) { |
1205 | 1205 | /// @todo should we sanitize the cookie name/value on behalf of the user? |
1206 | - $cookieHeader .= ' ' . $name . '=' . $cookie['value'] . ";"; |
|
1206 | + $cookieHeader .= ' '.$name.'='.$cookie['value'].";"; |
|
1207 | 1207 | } |
1208 | - $cookieHeader = 'Cookie:' . $version . substr($cookieHeader, 0, -1) . "\r\n"; |
|
1208 | + $cookieHeader = 'Cookie:'.$version.substr($cookieHeader, 0, -1)."\r\n"; |
|
1209 | 1209 | } |
1210 | 1210 | |
1211 | 1211 | // omit port if default |
1212 | 1212 | if (($port == 80 && in_array($method, array('http', 'http10'))) || ($port == 443 && $method == 'https')) { |
1213 | - $port = ''; |
|
1213 | + $port = ''; |
|
1214 | 1214 | } else { |
1215 | - $port = ':' . $port; |
|
1215 | + $port = ':'.$port; |
|
1216 | 1216 | } |
1217 | 1217 | |
1218 | - $op = 'POST ' . $uri . " HTTP/1.0\r\n" . |
|
1219 | - 'User-Agent: ' . $this->user_agent . "\r\n" . |
|
1220 | - 'Host: ' . $server . $port . "\r\n" . |
|
1221 | - $credentials . |
|
1222 | - $proxyCredentials . |
|
1223 | - $acceptedEncoding . |
|
1224 | - $encodingHdr . |
|
1225 | - 'Accept-Charset: ' . implode(',', $this->accepted_charset_encodings) . "\r\n" . |
|
1226 | - $cookieHeader . |
|
1227 | - 'Content-Type: ' . $req->content_type . "\r\nContent-Length: " . |
|
1228 | - strlen($payload) . "\r\n\r\n" . |
|
1218 | + $op = 'POST '.$uri." HTTP/1.0\r\n". |
|
1219 | + 'User-Agent: '.$this->user_agent."\r\n". |
|
1220 | + 'Host: '.$server.$port."\r\n". |
|
1221 | + $credentials. |
|
1222 | + $proxyCredentials. |
|
1223 | + $acceptedEncoding. |
|
1224 | + $encodingHdr. |
|
1225 | + 'Accept-Charset: '.implode(',', $this->accepted_charset_encodings)."\r\n". |
|
1226 | + $cookieHeader. |
|
1227 | + 'Content-Type: '.$req->content_type."\r\nContent-Length: ". |
|
1228 | + strlen($payload)."\r\n\r\n". |
|
1229 | 1229 | $payload; |
1230 | 1230 | |
1231 | - if ($this->debug > 1) { |
|
1231 | + if ($this->debug>1) { |
|
1232 | 1232 | $this->getLogger()->debug("---SENDING---\n$op\n---END---"); |
1233 | 1233 | } |
1234 | 1234 | |
@@ -1255,7 +1255,7 @@ discard block |
||
1255 | 1255 | |
1256 | 1256 | $context = stream_context_create($contextOptions); |
1257 | 1257 | |
1258 | - if ($timeout <= 0) { |
|
1258 | + if ($timeout<=0) { |
|
1259 | 1259 | $connectTimeout = ini_get('default_socket_timeout'); |
1260 | 1260 | } else { |
1261 | 1261 | $connectTimeout = $timeout; |
@@ -1267,7 +1267,7 @@ discard block |
||
1267 | 1267 | $fp = @stream_socket_client("$transport://$connectServer:$connectPort", $this->errno, $this->errstr, $connectTimeout, |
1268 | 1268 | STREAM_CLIENT_CONNECT, $context); |
1269 | 1269 | if ($fp) { |
1270 | - if ($timeout > 0) { |
|
1270 | + if ($timeout>0) { |
|
1271 | 1271 | stream_set_timeout($fp, $timeout, 0); |
1272 | 1272 | } |
1273 | 1273 | } else { |
@@ -1276,8 +1276,8 @@ discard block |
||
1276 | 1276 | $this->errstr = $err['message']; |
1277 | 1277 | } |
1278 | 1278 | |
1279 | - $this->errstr = 'Connect error: ' . $this->errstr; |
|
1280 | - $r = new static::$responseClass(0, PhpXmlRpc::$xmlrpcerr['http_error'], $this->errstr . ' (' . $this->errno . ')'); |
|
1279 | + $this->errstr = 'Connect error: '.$this->errstr; |
|
1280 | + $r = new static::$responseClass(0, PhpXmlRpc::$xmlrpcerr['http_error'], $this->errstr.' ('.$this->errno.')'); |
|
1281 | 1281 | |
1282 | 1282 | return $r; |
1283 | 1283 | } |
@@ -1365,18 +1365,18 @@ discard block |
||
1365 | 1365 | $keyPass, $sslVersion); |
1366 | 1366 | |
1367 | 1367 | if (!$curl) { |
1368 | - return new static::$responseClass(0, PhpXmlRpc::$xmlrpcerr['curl_fail'], PhpXmlRpc::$xmlrpcstr['curl_fail'] . ': error during curl initialization. Check php error log for details'); |
|
1368 | + return new static::$responseClass(0, PhpXmlRpc::$xmlrpcerr['curl_fail'], PhpXmlRpc::$xmlrpcstr['curl_fail'].': error during curl initialization. Check php error log for details'); |
|
1369 | 1369 | } |
1370 | 1370 | |
1371 | 1371 | $result = curl_exec($curl); |
1372 | 1372 | |
1373 | - if ($this->debug > 1) { |
|
1373 | + if ($this->debug>1) { |
|
1374 | 1374 | $message = "---CURL INFO---\n"; |
1375 | 1375 | foreach (curl_getinfo($curl) as $name => $val) { |
1376 | 1376 | if (is_array($val)) { |
1377 | 1377 | $val = implode("\n", $val); |
1378 | 1378 | } |
1379 | - $message .= $name . ': ' . $val . "\n"; |
|
1379 | + $message .= $name.': '.$val."\n"; |
|
1380 | 1380 | } |
1381 | 1381 | $message .= '---END---'; |
1382 | 1382 | $this->getLogger()->debug($message); |
@@ -1386,7 +1386,7 @@ discard block |
||
1386 | 1386 | /// @todo we should use a better check here - what if we get back '' or '0'? |
1387 | 1387 | |
1388 | 1388 | $this->errstr = 'no response'; |
1389 | - $resp = new static::$responseClass(0, PhpXmlRpc::$xmlrpcerr['curl_fail'], PhpXmlRpc::$xmlrpcstr['curl_fail'] . ': ' . curl_error($curl)); |
|
1389 | + $resp = new static::$responseClass(0, PhpXmlRpc::$xmlrpcerr['curl_fail'], PhpXmlRpc::$xmlrpcstr['curl_fail'].': '.curl_error($curl)); |
|
1390 | 1390 | curl_close($curl); |
1391 | 1391 | if ($keepAlive) { |
1392 | 1392 | $this->xmlrpc_curl_handle = null; |
@@ -1456,12 +1456,12 @@ discard block |
||
1456 | 1456 | // http, https |
1457 | 1457 | $protocol = $method; |
1458 | 1458 | if (strpos($protocol, ':') !== false) { |
1459 | - $this->getLogger()->error('XML-RPC: ' . __METHOD__ . ": warning - attempted hacking attempt?. The curl protocol requested for the call is: '$protocol'"); |
|
1459 | + $this->getLogger()->error('XML-RPC: '.__METHOD__.": warning - attempted hacking attempt?. The curl protocol requested for the call is: '$protocol'"); |
|
1460 | 1460 | return false; |
1461 | 1461 | } |
1462 | 1462 | } |
1463 | 1463 | } |
1464 | - $curl = curl_init($protocol . '://' . $server . ':' . $port . $this->path); |
|
1464 | + $curl = curl_init($protocol.'://'.$server.':'.$port.$this->path); |
|
1465 | 1465 | if (!$curl) { |
1466 | 1466 | return false; |
1467 | 1467 | } |
@@ -1475,7 +1475,7 @@ discard block |
||
1475 | 1475 | // results into variable |
1476 | 1476 | curl_setopt($curl, CURLOPT_RETURNTRANSFER, true); |
1477 | 1477 | |
1478 | - if ($this->debug > 1) { |
|
1478 | + if ($this->debug>1) { |
|
1479 | 1479 | curl_setopt($curl, CURLOPT_VERBOSE, true); |
1480 | 1480 | /// @todo redirect curlopt_stderr to some stream which can be piped to the logger |
1481 | 1481 | } |
@@ -1500,7 +1500,7 @@ discard block |
||
1500 | 1500 | } |
1501 | 1501 | } |
1502 | 1502 | // extra headers |
1503 | - $headers = array('Content-Type: ' . $req->content_type, 'Accept-Charset: ' . implode(',', $this->accepted_charset_encodings)); |
|
1503 | + $headers = array('Content-Type: '.$req->content_type, 'Accept-Charset: '.implode(',', $this->accepted_charset_encodings)); |
|
1504 | 1504 | // if no keepalive is wanted, let the server know it in advance |
1505 | 1505 | if (!$keepAlive) { |
1506 | 1506 | $headers[] = 'Connection: close'; |
@@ -1517,7 +1517,7 @@ discard block |
||
1517 | 1517 | curl_setopt($curl, CURLOPT_HTTPHEADER, $headers); |
1518 | 1518 | // timeout is borked |
1519 | 1519 | if ($timeout) { |
1520 | - curl_setopt($curl, CURLOPT_TIMEOUT, $timeout == 1 ? 1 : $timeout - 1); |
|
1520 | + curl_setopt($curl, CURLOPT_TIMEOUT, $timeout == 1 ? 1 : $timeout-1); |
|
1521 | 1521 | } |
1522 | 1522 | |
1523 | 1523 | switch ($method) { |
@@ -1532,7 +1532,7 @@ discard block |
||
1532 | 1532 | curl_setopt($curl, CURLOPT_HTTP_VERSION, CURL_HTTP_VERSION_2_PRIOR_KNOWLEDGE); |
1533 | 1533 | } else { |
1534 | 1534 | /// @todo make this a proper error, i.e. return a failure |
1535 | - $this->getLogger()->error('XML-RPC: ' . __METHOD__ . ': warning. HTTP2 is not supported by the current PHP/curl install'); |
|
1535 | + $this->getLogger()->error('XML-RPC: '.__METHOD__.': warning. HTTP2 is not supported by the current PHP/curl install'); |
|
1536 | 1536 | } |
1537 | 1537 | break; |
1538 | 1538 | case 'h2': |
@@ -1541,12 +1541,12 @@ discard block |
||
1541 | 1541 | } |
1542 | 1542 | |
1543 | 1543 | if ($username && $password) { |
1544 | - curl_setopt($curl, CURLOPT_USERPWD, $username . ':' . $password); |
|
1544 | + curl_setopt($curl, CURLOPT_USERPWD, $username.':'.$password); |
|
1545 | 1545 | if (defined('CURLOPT_HTTPAUTH')) { |
1546 | 1546 | curl_setopt($curl, CURLOPT_HTTPAUTH, $authType); |
1547 | 1547 | } elseif ($authType != 1) { |
1548 | 1548 | /// @todo make this a proper error, i.e. return a failure |
1549 | - $this->getLogger()->error('XML-RPC: ' . __METHOD__ . ': warning. Only Basic auth is supported by the current PHP/curl install'); |
|
1549 | + $this->getLogger()->error('XML-RPC: '.__METHOD__.': warning. Only Basic auth is supported by the current PHP/curl install'); |
|
1550 | 1550 | } |
1551 | 1551 | } |
1552 | 1552 | |
@@ -1589,14 +1589,14 @@ discard block |
||
1589 | 1589 | if ($proxyPort == 0) { |
1590 | 1590 | $proxyPort = 8080; // NB: even for HTTPS, local connection is on port 8080 |
1591 | 1591 | } |
1592 | - curl_setopt($curl, CURLOPT_PROXY, $proxyHost . ':' . $proxyPort); |
|
1592 | + curl_setopt($curl, CURLOPT_PROXY, $proxyHost.':'.$proxyPort); |
|
1593 | 1593 | if ($proxyUsername) { |
1594 | - curl_setopt($curl, CURLOPT_PROXYUSERPWD, $proxyUsername . ':' . $proxyPassword); |
|
1594 | + curl_setopt($curl, CURLOPT_PROXYUSERPWD, $proxyUsername.':'.$proxyPassword); |
|
1595 | 1595 | if (defined('CURLOPT_PROXYAUTH')) { |
1596 | 1596 | curl_setopt($curl, CURLOPT_PROXYAUTH, $proxyAuthType); |
1597 | 1597 | } elseif ($proxyAuthType != 1) { |
1598 | 1598 | /// @todo make this a proper error, i.e. return a failure |
1599 | - $this->getLogger()->error('XML-RPC: ' . __METHOD__ . ': warning. Only Basic auth to proxy is supported by the current PHP/curl install'); |
|
1599 | + $this->getLogger()->error('XML-RPC: '.__METHOD__.': warning. Only Basic auth to proxy is supported by the current PHP/curl install'); |
|
1600 | 1600 | } |
1601 | 1601 | } |
1602 | 1602 | } |
@@ -1606,7 +1606,7 @@ discard block |
||
1606 | 1606 | if (count($this->cookies)) { |
1607 | 1607 | $cookieHeader = ''; |
1608 | 1608 | foreach ($this->cookies as $name => $cookie) { |
1609 | - $cookieHeader .= $name . '=' . $cookie['value'] . '; '; |
|
1609 | + $cookieHeader .= $name.'='.$cookie['value'].'; '; |
|
1610 | 1610 | } |
1611 | 1611 | curl_setopt($curl, CURLOPT_COOKIE, substr($cookieHeader, 0, -2)); |
1612 | 1612 | } |
@@ -1615,7 +1615,7 @@ discard block |
||
1615 | 1615 | curl_setopt($curl, $opt, $val); |
1616 | 1616 | } |
1617 | 1617 | |
1618 | - if ($this->debug > 1) { |
|
1618 | + if ($this->debug>1) { |
|
1619 | 1619 | $this->getLogger()->debug("---SENDING---\n$payload\n---END---"); |
1620 | 1620 | } |
1621 | 1621 | |
@@ -1706,7 +1706,7 @@ discard block |
||
1706 | 1706 | $call['methodName'] = new Value($req->method(), 'string'); |
1707 | 1707 | $numParams = $req->getNumParams(); |
1708 | 1708 | $params = array(); |
1709 | - for ($i = 0; $i < $numParams; $i++) { |
|
1709 | + for ($i = 0; $i<$numParams; $i++) { |
|
1710 | 1710 | $params[$i] = $req->getParam($i); |
1711 | 1711 | } |
1712 | 1712 | $call['params'] = new Value($params, 'array'); |
@@ -1728,7 +1728,7 @@ discard block |
||
1728 | 1728 | $response = array(); |
1729 | 1729 | |
1730 | 1730 | if ($this->return_type == 'xml') { |
1731 | - for ($i = 0; $i < count($reqs); $i++) { |
|
1731 | + for ($i = 0; $i<count($reqs); $i++) { |
|
1732 | 1732 | $response[] = new Response($rets, 0, '', 'xml', $result->httpResponse()); |
1733 | 1733 | } |
1734 | 1734 | |
@@ -1736,21 +1736,21 @@ discard block |
||
1736 | 1736 | if (!is_array($rets)) { |
1737 | 1737 | // bad return type from system.multicall |
1738 | 1738 | return new Response(0, PhpXmlRpc::$xmlrpcerr['multicall_error'], |
1739 | - PhpXmlRpc::$xmlrpcstr['multicall_error'] . ': not an array', 'phpvals', $result->httpResponse()); |
|
1739 | + PhpXmlRpc::$xmlrpcstr['multicall_error'].': not an array', 'phpvals', $result->httpResponse()); |
|
1740 | 1740 | } |
1741 | 1741 | $numRets = count($rets); |
1742 | 1742 | if ($numRets != count($reqs)) { |
1743 | 1743 | // wrong number of return values. |
1744 | 1744 | return new Response(0, PhpXmlRpc::$xmlrpcerr['multicall_error'], |
1745 | - PhpXmlRpc::$xmlrpcstr['multicall_error'] . ': incorrect number of responses', 'phpvals', |
|
1745 | + PhpXmlRpc::$xmlrpcstr['multicall_error'].': incorrect number of responses', 'phpvals', |
|
1746 | 1746 | $result->httpResponse()); |
1747 | 1747 | } |
1748 | 1748 | |
1749 | - for ($i = 0; $i < $numRets; $i++) { |
|
1749 | + for ($i = 0; $i<$numRets; $i++) { |
|
1750 | 1750 | $val = $rets[$i]; |
1751 | 1751 | if (!is_array($val)) { |
1752 | 1752 | return new Response(0, PhpXmlRpc::$xmlrpcerr['multicall_error'], |
1753 | - PhpXmlRpc::$xmlrpcstr['multicall_error'] . ": response element $i is not an array or struct", |
|
1753 | + PhpXmlRpc::$xmlrpcstr['multicall_error'].": response element $i is not an array or struct", |
|
1754 | 1754 | 'phpvals', $result->httpResponse()); |
1755 | 1755 | } |
1756 | 1756 | switch (count($val)) { |
@@ -1758,7 +1758,7 @@ discard block |
||
1758 | 1758 | if (!isset($val[0])) { |
1759 | 1759 | // Bad value |
1760 | 1760 | return new Response(0, PhpXmlRpc::$xmlrpcerr['multicall_error'], |
1761 | - PhpXmlRpc::$xmlrpcstr['multicall_error'] . ": response element $i has no value", |
|
1761 | + PhpXmlRpc::$xmlrpcstr['multicall_error'].": response element $i has no value", |
|
1762 | 1762 | 'phpvals', $result->httpResponse()); |
1763 | 1763 | } |
1764 | 1764 | // Normal return value |
@@ -1770,20 +1770,20 @@ discard block |
||
1770 | 1770 | if (!is_int($code)) { |
1771 | 1771 | /// @todo should we check that it is != 0? |
1772 | 1772 | return new Response(0, PhpXmlRpc::$xmlrpcerr['multicall_error'], |
1773 | - PhpXmlRpc::$xmlrpcstr['multicall_error'] . ": response element $i has invalid or no faultCode", |
|
1773 | + PhpXmlRpc::$xmlrpcstr['multicall_error'].": response element $i has invalid or no faultCode", |
|
1774 | 1774 | 'phpvals', $result->httpResponse()); |
1775 | 1775 | } |
1776 | 1776 | $str = @$val['faultString']; |
1777 | 1777 | if (!is_string($str)) { |
1778 | 1778 | return new Response(0, PhpXmlRpc::$xmlrpcerr['multicall_error'], |
1779 | - PhpXmlRpc::$xmlrpcstr['multicall_error'] . ": response element $i has invalid or no FaultString", |
|
1779 | + PhpXmlRpc::$xmlrpcstr['multicall_error'].": response element $i has invalid or no FaultString", |
|
1780 | 1780 | 'phpvals', $result->httpResponse()); |
1781 | 1781 | } |
1782 | 1782 | $response[$i] = new Response(0, $code, $str, 'phpvals', $result->httpResponse()); |
1783 | 1783 | break; |
1784 | 1784 | default: |
1785 | 1785 | return new Response(0, PhpXmlRpc::$xmlrpcerr['multicall_error'], |
1786 | - PhpXmlRpc::$xmlrpcstr['multicall_error'] . ": response element $i has too many items", |
|
1786 | + PhpXmlRpc::$xmlrpcstr['multicall_error'].": response element $i has too many items", |
|
1787 | 1787 | 'phpvals', $result->httpResponse()); |
1788 | 1788 | } |
1789 | 1789 | } |
@@ -1792,14 +1792,14 @@ discard block |
||
1792 | 1792 | // return type == 'xmlrpcvals' |
1793 | 1793 | if ($rets->kindOf() != 'array') { |
1794 | 1794 | return new Response(0, PhpXmlRpc::$xmlrpcerr['multicall_error'], |
1795 | - PhpXmlRpc::$xmlrpcstr['multicall_error'] . ": response element $i is not an array", 'xmlrpcvals', |
|
1795 | + PhpXmlRpc::$xmlrpcstr['multicall_error'].": response element $i is not an array", 'xmlrpcvals', |
|
1796 | 1796 | $result->httpResponse()); |
1797 | 1797 | } |
1798 | 1798 | $numRets = $rets->count(); |
1799 | 1799 | if ($numRets != count($reqs)) { |
1800 | 1800 | // wrong number of return values. |
1801 | 1801 | return new Response(0, PhpXmlRpc::$xmlrpcerr['multicall_error'], |
1802 | - PhpXmlRpc::$xmlrpcstr['multicall_error'] . ': incorrect number of responses', 'xmlrpcvals', |
|
1802 | + PhpXmlRpc::$xmlrpcstr['multicall_error'].': incorrect number of responses', 'xmlrpcvals', |
|
1803 | 1803 | $result->httpResponse()); |
1804 | 1804 | } |
1805 | 1805 | |
@@ -1808,7 +1808,7 @@ discard block |
||
1808 | 1808 | case 'array': |
1809 | 1809 | if ($val->count() != 1) { |
1810 | 1810 | return new Response(0, PhpXmlRpc::$xmlrpcerr['multicall_error'], |
1811 | - PhpXmlRpc::$xmlrpcstr['multicall_error'] . ": response element $i has too many items", |
|
1811 | + PhpXmlRpc::$xmlrpcstr['multicall_error'].": response element $i has too many items", |
|
1812 | 1812 | 'phpvals', $result->httpResponse()); |
1813 | 1813 | } |
1814 | 1814 | // Normal return value |
@@ -1817,28 +1817,28 @@ discard block |
||
1817 | 1817 | case 'struct': |
1818 | 1818 | if ($val->count() != 2) { |
1819 | 1819 | return new Response(0, PhpXmlRpc::$xmlrpcerr['multicall_error'], |
1820 | - PhpXmlRpc::$xmlrpcstr['multicall_error'] . ": response element $i has too many items", |
|
1820 | + PhpXmlRpc::$xmlrpcstr['multicall_error'].": response element $i has too many items", |
|
1821 | 1821 | 'phpvals', $result->httpResponse()); |
1822 | 1822 | } |
1823 | 1823 | /** @var Value $code */ |
1824 | 1824 | $code = $val['faultCode']; |
1825 | 1825 | if ($code->kindOf() != 'scalar' || $code->scalarTyp() != 'int') { |
1826 | 1826 | return new Response(0, PhpXmlRpc::$xmlrpcerr['multicall_error'], |
1827 | - PhpXmlRpc::$xmlrpcstr['multicall_error'] . ": response element $i has invalid or no faultCode", |
|
1827 | + PhpXmlRpc::$xmlrpcstr['multicall_error'].": response element $i has invalid or no faultCode", |
|
1828 | 1828 | 'xmlrpcvals', $result->httpResponse()); |
1829 | 1829 | } |
1830 | 1830 | /** @var Value $str */ |
1831 | 1831 | $str = $val['faultString']; |
1832 | 1832 | if ($str->kindOf() != 'scalar' || $str->scalarTyp() != 'string') { |
1833 | 1833 | return new Response(0, PhpXmlRpc::$xmlrpcerr['multicall_error'], |
1834 | - PhpXmlRpc::$xmlrpcstr['multicall_error'] . ": response element $i has invalid or no faultCode", |
|
1834 | + PhpXmlRpc::$xmlrpcstr['multicall_error'].": response element $i has invalid or no faultCode", |
|
1835 | 1835 | 'xmlrpcvals', $result->httpResponse()); |
1836 | 1836 | } |
1837 | 1837 | $response[] = new Response(0, $code->scalarVal(), $str->scalarVal(), 'xmlrpcvals', $result->httpResponse()); |
1838 | 1838 | break; |
1839 | 1839 | default: |
1840 | 1840 | return new Response(0, PhpXmlRpc::$xmlrpcerr['multicall_error'], |
1841 | - PhpXmlRpc::$xmlrpcstr['multicall_error'] . ": response element $i is not an array or struct", |
|
1841 | + PhpXmlRpc::$xmlrpcstr['multicall_error'].": response element $i is not an array or struct", |
|
1842 | 1842 | 'xmlrpcvals', $result->httpResponse()); |
1843 | 1843 | } |
1844 | 1844 | } |
@@ -57,13 +57,13 @@ discard block |
||
57 | 57 | 'scalar' => $val, |
58 | 58 | 'timestamp' => \PhpXmlRpc\Helper\Date::iso8601Decode($val) |
59 | 59 | ); |
60 | - return (object)$xmlrpcVal; |
|
60 | + return (object) $xmlrpcVal; |
|
61 | 61 | case 'base64': |
62 | 62 | $xmlrpcVal = array( |
63 | 63 | 'xmlrpc_type' => 'base64', |
64 | 64 | 'scalar' => $val |
65 | 65 | ); |
66 | - return (object)$xmlrpcVal; |
|
66 | + return (object) $xmlrpcVal; |
|
67 | 67 | case 'string': |
68 | 68 | if (isset($options['extension_api_encoding'])) { |
69 | 69 | // if iconv is not available, we use mb_convert_encoding |
@@ -136,7 +136,7 @@ discard block |
||
136 | 136 | case 'msg': |
137 | 137 | $paramCount = $xmlrpcVal->getNumParams(); |
138 | 138 | $arr = array(); |
139 | - for ($i = 0; $i < $paramCount; $i++) { |
|
139 | + for ($i = 0; $i<$paramCount; $i++) { |
|
140 | 140 | $arr[] = $this->decode($xmlrpcVal->getParam($i), $options); |
141 | 141 | } |
142 | 142 | return $arr; |
@@ -261,7 +261,7 @@ discard block |
||
261 | 261 | break; |
262 | 262 | case 'resource': |
263 | 263 | if (in_array('extension_api', $options)) { |
264 | - $xmlrpcVal = new Value((int)$phpVal, Value::$xmlrpcInt); |
|
264 | + $xmlrpcVal = new Value((int) $phpVal, Value::$xmlrpcInt); |
|
265 | 265 | } else { |
266 | 266 | $xmlrpcVal = new Value(); |
267 | 267 | } |
@@ -310,7 +310,7 @@ discard block |
||
310 | 310 | if ($valEncoding == 'ISO-8859-1') { |
311 | 311 | $xmlVal = utf8_encode($xmlVal); |
312 | 312 | } else { |
313 | - $this->getLogger()->error('XML-RPC: ' . __METHOD__ . ': invalid charset encoding of xml text: ' . $valEncoding); |
|
313 | + $this->getLogger()->error('XML-RPC: '.__METHOD__.': invalid charset encoding of xml text: '.$valEncoding); |
|
314 | 314 | } |
315 | 315 | } |
316 | 316 | } |
@@ -332,10 +332,10 @@ discard block |
||
332 | 332 | $parserOptions |
333 | 333 | ); |
334 | 334 | |
335 | - if ($xmlRpcParser->_xh['isf'] > 1) { |
|
335 | + if ($xmlRpcParser->_xh['isf']>1) { |
|
336 | 336 | // test that $xmlrpc->_xh['value'] is an obj, too??? |
337 | 337 | |
338 | - $this->getLogger()->error('XML-RPC: ' . $xmlRpcParser->_xh['isf_reason']); |
|
338 | + $this->getLogger()->error('XML-RPC: '.$xmlRpcParser->_xh['isf_reason']); |
|
339 | 339 | |
340 | 340 | return false; |
341 | 341 | } |
@@ -356,7 +356,7 @@ discard block |
||
356 | 356 | |
357 | 357 | case 'methodcall': |
358 | 358 | $req = new Request($xmlRpcParser->_xh['method']); |
359 | - for ($i = 0; $i < count($xmlRpcParser->_xh['params']); $i++) { |
|
359 | + for ($i = 0; $i<count($xmlRpcParser->_xh['params']); $i++) { |
|
360 | 360 | $req->addParam($xmlRpcParser->_xh['params'][$i]); |
361 | 361 | } |
362 | 362 | return $req; |
@@ -73,7 +73,7 @@ discard block |
||
73 | 73 | // user declares the type of resp value: we "almost" trust it... but log errors just in case |
74 | 74 | if (($this->valtyp == 'xmlrpcvals' && (!is_a($this->val, 'PhpXmlRpc\Value'))) || |
75 | 75 | ($this->valtyp == 'xml' && (!is_string($this->val)))) { |
76 | - $this->getLogger()->error('XML-RPC: ' . __METHOD__ . ': value passed in does not match type ' . $valType); |
|
76 | + $this->getLogger()->error('XML-RPC: '.__METHOD__.': value passed in does not match type '.$valType); |
|
77 | 77 | } |
78 | 78 | } |
79 | 79 | } |
@@ -152,33 +152,33 @@ discard block |
||
152 | 152 | public function serialize($charsetEncoding = '') |
153 | 153 | { |
154 | 154 | if ($charsetEncoding != '') { |
155 | - $this->content_type = 'text/xml; charset=' . $charsetEncoding; |
|
155 | + $this->content_type = 'text/xml; charset='.$charsetEncoding; |
|
156 | 156 | } else { |
157 | 157 | $this->content_type = 'text/xml'; |
158 | 158 | } |
159 | 159 | if (PhpXmlRpc::$xmlrpc_null_apache_encoding) { |
160 | - $result = "<methodResponse xmlns:ex=\"" . PhpXmlRpc::$xmlrpc_null_apache_encoding_ns . "\">\n"; |
|
160 | + $result = "<methodResponse xmlns:ex=\"".PhpXmlRpc::$xmlrpc_null_apache_encoding_ns."\">\n"; |
|
161 | 161 | } else { |
162 | 162 | $result = "<methodResponse>\n"; |
163 | 163 | } |
164 | 164 | if ($this->errno) { |
165 | 165 | // Let non-ASCII response messages be tolerated by clients by xml-encoding non ascii chars |
166 | - $result .= "<fault>\n" . |
|
167 | - "<value>\n<struct><member><name>faultCode</name>\n<value><int>" . $this->errno . |
|
168 | - "</int></value>\n</member>\n<member>\n<name>faultString</name>\n<value><string>" . |
|
169 | - $this->getCharsetEncoder()->encodeEntities($this->errstr, PhpXmlRpc::$xmlrpc_internalencoding, $charsetEncoding) . |
|
166 | + $result .= "<fault>\n". |
|
167 | + "<value>\n<struct><member><name>faultCode</name>\n<value><int>".$this->errno. |
|
168 | + "</int></value>\n</member>\n<member>\n<name>faultString</name>\n<value><string>". |
|
169 | + $this->getCharsetEncoder()->encodeEntities($this->errstr, PhpXmlRpc::$xmlrpc_internalencoding, $charsetEncoding). |
|
170 | 170 | "</string></value>\n</member>\n</struct>\n</value>\n</fault>"; |
171 | 171 | } else { |
172 | 172 | if (is_object($this->val) && is_a($this->val, 'PhpXmlRpc\Value')) { |
173 | - $result .= "<params>\n<param>\n" . $this->val->serialize($charsetEncoding) . "</param>\n</params>"; |
|
173 | + $result .= "<params>\n<param>\n".$this->val->serialize($charsetEncoding)."</param>\n</params>"; |
|
174 | 174 | } else if (is_string($this->val) && $this->valtyp == 'xml') { |
175 | - $result .= "<params>\n<param>\n" . |
|
176 | - $this->val . |
|
175 | + $result .= "<params>\n<param>\n". |
|
176 | + $this->val. |
|
177 | 177 | "</param>\n</params>"; |
178 | 178 | } else if ($this->valtyp == 'phpvals') { |
179 | 179 | $encoder = new Encoder(); |
180 | 180 | $val = $encoder->encode($this->val); |
181 | - $result .= "<params>\n<param>\n" . $val->serialize($charsetEncoding) . "</param>\n</params>"; |
|
181 | + $result .= "<params>\n<param>\n".$val->serialize($charsetEncoding)."</param>\n</params>"; |
|
182 | 182 | } else { |
183 | 183 | throw new StateErrorException('cannot serialize xmlrpc response objects whose content is native php values'); |
184 | 184 | } |
@@ -196,18 +196,18 @@ discard block |
||
196 | 196 | { |
197 | 197 | switch ($name) { |
198 | 198 | case 'hdrs': |
199 | - $this->logDeprecation('Getting property Response::' . $name . ' is deprecated'); |
|
199 | + $this->logDeprecation('Getting property Response::'.$name.' is deprecated'); |
|
200 | 200 | return $this->httpResponse['headers']; |
201 | 201 | case '_cookies': |
202 | - $this->logDeprecation('Getting property Response::' . $name . ' is deprecated'); |
|
202 | + $this->logDeprecation('Getting property Response::'.$name.' is deprecated'); |
|
203 | 203 | return $this->httpResponse['cookies']; |
204 | 204 | case 'raw_data': |
205 | - $this->logDeprecation('Getting property Response::' . $name . ' is deprecated'); |
|
205 | + $this->logDeprecation('Getting property Response::'.$name.' is deprecated'); |
|
206 | 206 | return $this->httpResponse['raw_data']; |
207 | 207 | default: |
208 | 208 | /// @todo throw instead? There are very few other places where the lib trigger errors which can potentially reach stdout... |
209 | 209 | $trace = debug_backtrace(DEBUG_BACKTRACE_IGNORE_ARGS); |
210 | - trigger_error('Undefined property via __get(): ' . $name . ' in ' . $trace[0]['file'] . ' on line ' . $trace[0]['line'], E_USER_WARNING); |
|
210 | + trigger_error('Undefined property via __get(): '.$name.' in '.$trace[0]['file'].' on line '.$trace[0]['line'], E_USER_WARNING); |
|
211 | 211 | return null; |
212 | 212 | } |
213 | 213 | } |
@@ -216,21 +216,21 @@ discard block |
||
216 | 216 | { |
217 | 217 | switch ($name) { |
218 | 218 | case 'hdrs': |
219 | - $this->logDeprecation('Setting property Response::' . $name . ' is deprecated'); |
|
219 | + $this->logDeprecation('Setting property Response::'.$name.' is deprecated'); |
|
220 | 220 | $this->httpResponse['headers'] = $value; |
221 | 221 | break; |
222 | 222 | case '_cookies': |
223 | - $this->logDeprecation('Setting property Response::' . $name . ' is deprecated'); |
|
223 | + $this->logDeprecation('Setting property Response::'.$name.' is deprecated'); |
|
224 | 224 | $this->httpResponse['cookies'] = $value; |
225 | 225 | break; |
226 | 226 | case 'raw_data': |
227 | - $this->logDeprecation('Setting property Response::' . $name . ' is deprecated'); |
|
227 | + $this->logDeprecation('Setting property Response::'.$name.' is deprecated'); |
|
228 | 228 | $this->httpResponse['raw_data'] = $value; |
229 | 229 | break; |
230 | 230 | default: |
231 | 231 | /// @todo throw instead? There are very few other places where the lib trigger errors which can potentially reach stdout... |
232 | 232 | $trace = debug_backtrace(DEBUG_BACKTRACE_IGNORE_ARGS); |
233 | - trigger_error('Undefined property via __set(): ' . $name . ' in ' . $trace[0]['file'] . ' on line ' . $trace[0]['line'], E_USER_WARNING); |
|
233 | + trigger_error('Undefined property via __set(): '.$name.' in '.$trace[0]['file'].' on line '.$trace[0]['line'], E_USER_WARNING); |
|
234 | 234 | } |
235 | 235 | } |
236 | 236 | |
@@ -238,13 +238,13 @@ discard block |
||
238 | 238 | { |
239 | 239 | switch ($name) { |
240 | 240 | case 'hdrs': |
241 | - $this->logDeprecation('Checking property Response::' . $name . ' is deprecated'); |
|
241 | + $this->logDeprecation('Checking property Response::'.$name.' is deprecated'); |
|
242 | 242 | return isset($this->httpResponse['headers']); |
243 | 243 | case '_cookies': |
244 | - $this->logDeprecation('Checking property Response::' . $name . ' is deprecated'); |
|
244 | + $this->logDeprecation('Checking property Response::'.$name.' is deprecated'); |
|
245 | 245 | return isset($this->httpResponse['cookies']); |
246 | 246 | case 'raw_data': |
247 | - $this->logDeprecation('Checking property Response::' . $name . ' is deprecated'); |
|
247 | + $this->logDeprecation('Checking property Response::'.$name.' is deprecated'); |
|
248 | 248 | return isset($this->httpResponse['raw_data']); |
249 | 249 | default: |
250 | 250 | return false; |
@@ -255,21 +255,21 @@ discard block |
||
255 | 255 | { |
256 | 256 | switch ($name) { |
257 | 257 | case 'hdrs': |
258 | - $this->logDeprecation('Unsetting property Response::' . $name . ' is deprecated'); |
|
258 | + $this->logDeprecation('Unsetting property Response::'.$name.' is deprecated'); |
|
259 | 259 | unset($this->httpResponse['headers']); |
260 | 260 | break; |
261 | 261 | case '_cookies': |
262 | - $this->logDeprecation('Unsetting property Response::' . $name . ' is deprecated'); |
|
262 | + $this->logDeprecation('Unsetting property Response::'.$name.' is deprecated'); |
|
263 | 263 | unset($this->httpResponse['cookies']); |
264 | 264 | break; |
265 | 265 | case 'raw_data': |
266 | - $this->logDeprecation('Unsetting property Response::' . $name . ' is deprecated'); |
|
266 | + $this->logDeprecation('Unsetting property Response::'.$name.' is deprecated'); |
|
267 | 267 | unset($this->httpResponse['raw_data']); |
268 | 268 | break; |
269 | 269 | default: |
270 | 270 | /// @todo throw instead? There are very few other places where the lib trigger errors which can potentially reach stdout... |
271 | 271 | $trace = debug_backtrace(DEBUG_BACKTRACE_IGNORE_ARGS); |
272 | - trigger_error('Undefined property via __unset(): ' . $name . ' in ' . $trace[0]['file'] . ' on line ' . $trace[0]['line'], E_USER_WARNING); |
|
272 | + trigger_error('Undefined property via __unset(): '.$name.' in '.$trace[0]['file'].' on line '.$trace[0]['line'], E_USER_WARNING); |
|
273 | 273 | } |
274 | 274 | } |
275 | 275 | } |
@@ -76,14 +76,14 @@ discard block |
||
76 | 76 | if (count($this->xml_iso88591_Entities['in'])) { |
77 | 77 | return; |
78 | 78 | } |
79 | - for ($i = 0; $i < 32; $i++) { |
|
79 | + for ($i = 0; $i<32; $i++) { |
|
80 | 80 | $this->xml_iso88591_Entities["in"][] = chr($i); |
81 | 81 | $this->xml_iso88591_Entities["out"][] = "&#{$i};"; |
82 | 82 | } |
83 | 83 | |
84 | 84 | /// @todo to be 'print safe', should we encode as well character 127 (DEL) ? |
85 | 85 | |
86 | - for ($i = 160; $i < 256; $i++) { |
|
86 | + for ($i = 160; $i<256; $i++) { |
|
87 | 87 | $this->xml_iso88591_Entities["in"][] = chr($i); |
88 | 88 | $this->xml_iso88591_Entities["out"][] = "&#{$i};"; |
89 | 89 | } |
@@ -111,7 +111,7 @@ discard block |
||
111 | 111 | break;*/ |
112 | 112 | |
113 | 113 | default: |
114 | - throw new ValueErrorException('Unsupported table: ' . $tableName); |
|
114 | + throw new ValueErrorException('Unsupported table: '.$tableName); |
|
115 | 115 | } |
116 | 116 | } |
117 | 117 | |
@@ -163,7 +163,7 @@ discard block |
||
163 | 163 | $srcEncoding = 'UTF-8'; |
164 | 164 | } |
165 | 165 | |
166 | - $conversion = strtoupper($srcEncoding . '_' . $destEncoding); |
|
166 | + $conversion = strtoupper($srcEncoding.'_'.$destEncoding); |
|
167 | 167 | |
168 | 168 | // list ordered with (expected) most common scenarios first |
169 | 169 | switch ($conversion) { |
@@ -181,20 +181,20 @@ discard block |
||
181 | 181 | // NB: this will choke on invalid UTF-8, going most likely beyond EOF |
182 | 182 | $escapedData = ''; |
183 | 183 | // be kind to users creating string xml-rpc values out of different php types |
184 | - $data = (string)$data; |
|
184 | + $data = (string) $data; |
|
185 | 185 | $ns = strlen($data); |
186 | - for ($nn = 0; $nn < $ns; $nn++) { |
|
186 | + for ($nn = 0; $nn<$ns; $nn++) { |
|
187 | 187 | $ch = $data[$nn]; |
188 | 188 | $ii = ord($ch); |
189 | 189 | // 7 bits in 1 byte: 0bbbbbbb (127) |
190 | - if ($ii < 32) { |
|
190 | + if ($ii<32) { |
|
191 | 191 | if ($conversion == 'UTF-8_US-ASCII') { |
192 | 192 | $escapedData .= sprintf('&#%d;', $ii); |
193 | 193 | } else { |
194 | 194 | $escapedData .= $ch; |
195 | 195 | } |
196 | 196 | } |
197 | - else if ($ii < 128) { |
|
197 | + else if ($ii<128) { |
|
198 | 198 | /// @todo shall we replace this with a (supposedly) faster str_replace? |
199 | 199 | /// @todo to be 'print safe', should we encode as well character 127 (DEL) ? |
200 | 200 | switch ($ii) { |
@@ -219,25 +219,25 @@ discard block |
||
219 | 219 | } // 11 bits in 2 bytes: 110bbbbb 10bbbbbb (2047) |
220 | 220 | elseif ($ii >> 5 == 6) { |
221 | 221 | $b1 = ($ii & 31); |
222 | - $b2 = (ord($data[$nn + 1]) & 63); |
|
223 | - $ii = ($b1 * 64) + $b2; |
|
222 | + $b2 = (ord($data[$nn+1]) & 63); |
|
223 | + $ii = ($b1 * 64)+$b2; |
|
224 | 224 | $escapedData .= sprintf('&#%d;', $ii); |
225 | 225 | $nn += 1; |
226 | 226 | } // 16 bits in 3 bytes: 1110bbbb 10bbbbbb 10bbbbbb |
227 | 227 | elseif ($ii >> 4 == 14) { |
228 | 228 | $b1 = ($ii & 15); |
229 | - $b2 = (ord($data[$nn + 1]) & 63); |
|
230 | - $b3 = (ord($data[$nn + 2]) & 63); |
|
231 | - $ii = ((($b1 * 64) + $b2) * 64) + $b3; |
|
229 | + $b2 = (ord($data[$nn+1]) & 63); |
|
230 | + $b3 = (ord($data[$nn+2]) & 63); |
|
231 | + $ii = ((($b1 * 64)+$b2) * 64)+$b3; |
|
232 | 232 | $escapedData .= sprintf('&#%d;', $ii); |
233 | 233 | $nn += 2; |
234 | 234 | } // 21 bits in 4 bytes: 11110bbb 10bbbbbb 10bbbbbb 10bbbbbb |
235 | 235 | elseif ($ii >> 3 == 30) { |
236 | 236 | $b1 = ($ii & 7); |
237 | - $b2 = (ord($data[$nn + 1]) & 63); |
|
238 | - $b3 = (ord($data[$nn + 2]) & 63); |
|
239 | - $b4 = (ord($data[$nn + 3]) & 63); |
|
240 | - $ii = ((((($b1 * 64) + $b2) * 64) + $b3) * 64) + $b4; |
|
237 | + $b2 = (ord($data[$nn+1]) & 63); |
|
238 | + $b3 = (ord($data[$nn+2]) & 63); |
|
239 | + $b4 = (ord($data[$nn+3]) & 63); |
|
240 | + $ii = ((((($b1 * 64)+$b2) * 64)+$b3) * 64)+$b4; |
|
241 | 241 | $escapedData .= sprintf('&#%d;', $ii); |
242 | 242 | $nn += 3; |
243 | 243 | } |
@@ -290,7 +290,7 @@ discard block |
||
290 | 290 | // If src is UTF8, we run htmlspecialchars before converting to the target charset, as |
291 | 291 | // htmlspecialchars has limited charset support, but it groks utf8 |
292 | 292 | if ($srcEncoding === 'UTF-8') { |
293 | - $data = htmlspecialchars($data, defined('ENT_XML1') ? ENT_XML1 | ENT_QUOTES : ENT_QUOTES, 'UTF-8'); |
|
293 | + $data = htmlspecialchars($data, defined('ENT_XML1') ? ENT_XML1 | ENT_QUOTES : ENT_QUOTES, 'UTF-8'); |
|
294 | 294 | } |
295 | 295 | if ($srcEncoding !== $destEncoding) { |
296 | 296 | try { |
@@ -302,7 +302,7 @@ discard block |
||
302 | 302 | } |
303 | 303 | if ($data === false) { |
304 | 304 | $escapedData = ''; |
305 | - $this->getLogger()->error('XML-RPC: ' . __METHOD__ . ": Converting from $srcEncoding to $destEncoding via mbstring: failed..."); |
|
305 | + $this->getLogger()->error('XML-RPC: '.__METHOD__.": Converting from $srcEncoding to $destEncoding via mbstring: failed..."); |
|
306 | 306 | } else { |
307 | 307 | if ($srcEncoding === 'UTF-8') { |
308 | 308 | $escapedData = $data; |
@@ -312,7 +312,7 @@ discard block |
||
312 | 312 | } |
313 | 313 | } else { |
314 | 314 | $escapedData = ''; |
315 | - $this->getLogger()->error('XML-RPC: ' . __METHOD__ . ": Converting from $srcEncoding to $destEncoding: not supported..."); |
|
315 | + $this->getLogger()->error('XML-RPC: '.__METHOD__.": Converting from $srcEncoding to $destEncoding: not supported..."); |
|
316 | 316 | } |
317 | 317 | } |
318 | 318 | |
@@ -330,7 +330,7 @@ discard block |
||
330 | 330 | if (function_exists('mb_list_encodings')) { |
331 | 331 | $knownCharsets = array_unique(array_merge($knownCharsets, array_diff(mb_list_encodings(), array( |
332 | 332 | 'pass', 'auto', 'wchar', 'BASE64', 'UUENCODE', 'ASCII', 'HTML-ENTITIES', 'Quoted-Printable', |
333 | - '7bit','8bit', 'byte2be', 'byte2le', 'byte4be', 'byte4le' |
|
333 | + '7bit', '8bit', 'byte2be', 'byte2le', 'byte4be', 'byte4le' |
|
334 | 334 | )))); |
335 | 335 | } |
336 | 336 | return $knownCharsets; |
@@ -347,7 +347,7 @@ discard block |
||
347 | 347 | */ |
348 | 348 | public function isValidCharset($encoding, $validList) |
349 | 349 | { |
350 | - $this->logDeprecation('Method ' . __METHOD__ . ' is deprecated'); |
|
350 | + $this->logDeprecation('Method '.__METHOD__.' is deprecated'); |
|
351 | 351 | |
352 | 352 | if (is_string($validList)) { |
353 | 353 | $validList = explode(',', $validList); |
@@ -377,14 +377,14 @@ discard block |
||
377 | 377 | */ |
378 | 378 | public function getEntities($charset) |
379 | 379 | { |
380 | - $this->logDeprecation('Method ' . __METHOD__ . ' is deprecated'); |
|
380 | + $this->logDeprecation('Method '.__METHOD__.' is deprecated'); |
|
381 | 381 | |
382 | 382 | switch ($charset) |
383 | 383 | { |
384 | 384 | case 'iso88591': |
385 | 385 | return $this->xml_iso88591_Entities; |
386 | 386 | default: |
387 | - throw new ValueErrorException('Unsupported charset: ' . $charset); |
|
387 | + throw new ValueErrorException('Unsupported charset: '.$charset); |
|
388 | 388 | } |
389 | 389 | } |
390 | 390 | } |
@@ -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 | |
@@ -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 | |
@@ -509,7 +509,7 @@ discard block |
||
509 | 509 | */ |
510 | 510 | public function xmlrpc_ee($parser, $name, $rebuildXmlrpcvals = 1) |
511 | 511 | { |
512 | - if ($this->_xh['isf'] >= 2) { |
|
512 | + if ($this->_xh['isf']>=2) { |
|
513 | 513 | return; |
514 | 514 | } |
515 | 515 | |
@@ -531,7 +531,7 @@ discard block |
||
531 | 531 | $this->_xh['value'] = mb_convert_encoding($this->_xh['value'], $this->current_parsing_options['target_charset'], 'UTF-8'); |
532 | 532 | } |
533 | 533 | |
534 | - if ($rebuildXmlrpcvals > 0) { |
|
534 | + if ($rebuildXmlrpcvals>0) { |
|
535 | 535 | // build the xml-rpc val out of the data received, and substitute it |
536 | 536 | $temp = new Value($this->_xh['value'], $this->_xh['vt']); |
537 | 537 | // in case we got info about underlying php class, save it in the object we're rebuilding |
@@ -539,15 +539,15 @@ discard block |
||
539 | 539 | $temp->_php_class = $this->_xh['php_class']; |
540 | 540 | } |
541 | 541 | $this->_xh['value'] = $temp; |
542 | - } elseif ($rebuildXmlrpcvals < 0) { |
|
542 | + } elseif ($rebuildXmlrpcvals<0) { |
|
543 | 543 | if ($this->_xh['vt'] == Value::$xmlrpcDateTime) { |
544 | - $this->_xh['value'] = (object)array( |
|
544 | + $this->_xh['value'] = (object) array( |
|
545 | 545 | 'xmlrpc_type' => 'datetime', |
546 | 546 | 'scalar' => $this->_xh['value'], |
547 | 547 | 'timestamp' => \PhpXmlRpc\Helper\Date::iso8601Decode($this->_xh['value']) |
548 | 548 | ); |
549 | 549 | } elseif ($this->_xh['vt'] == Value::$xmlrpcBase64) { |
550 | - $this->_xh['value'] = (object)array( |
|
550 | + $this->_xh['value'] = (object) array( |
|
551 | 551 | 'xmlrpc_type' => 'base64', |
552 | 552 | 'scalar' => $this->_xh['value'] |
553 | 553 | ); |
@@ -562,8 +562,8 @@ discard block |
||
562 | 562 | // check if we are inside an array or struct: |
563 | 563 | // if value just built is inside an array, let's move it into array on the stack |
564 | 564 | $vscount = count($this->_xh['valuestack']); |
565 | - if ($vscount && $this->_xh['valuestack'][$vscount - 1]['type'] == 'ARRAY') { |
|
566 | - $this->_xh['valuestack'][$vscount - 1]['values'][] = $this->_xh['value']; |
|
565 | + if ($vscount && $this->_xh['valuestack'][$vscount-1]['type'] == 'ARRAY') { |
|
566 | + $this->_xh['valuestack'][$vscount-1]['values'][] = $this->_xh['value']; |
|
567 | 567 | } |
568 | 568 | break; |
569 | 569 | |
@@ -590,7 +590,7 @@ discard block |
||
590 | 590 | // log if receiving something strange, even though we set the value to false anyway |
591 | 591 | /// @todo to be consistent with the other types, we should return a value outside the good-value domain, e.g. NULL |
592 | 592 | if ($this->_xh['ac'] != '0' && strcasecmp($this->_xh['ac'], 'false') !== 0) { |
593 | - if (!$this->handleParsingError('invalid data received in BOOLEAN value: ' . |
|
593 | + if (!$this->handleParsingError('invalid data received in BOOLEAN value: '. |
|
594 | 594 | $this->truncateValueForLog($this->_xh['ac']), __METHOD__)) { |
595 | 595 | return; |
596 | 596 | } |
@@ -610,7 +610,7 @@ discard block |
||
610 | 610 | $this->_xh['vt'] = strtolower($name); |
611 | 611 | $this->_xh['lv'] = 3; // indicate we've found a value |
612 | 612 | if (!preg_match(PhpXmlRpc::$xmlrpc_int_format, $this->_xh['ac'])) { |
613 | - if (!$this->handleParsingError('non numeric data received in INT value: ' . |
|
613 | + if (!$this->handleParsingError('non numeric data received in INT value: '. |
|
614 | 614 | $this->truncateValueForLog($this->_xh['ac']), __METHOD__)) { |
615 | 615 | return; |
616 | 616 | } |
@@ -618,7 +618,7 @@ discard block |
||
618 | 618 | $this->_xh['value'] = 'ERROR_NON_NUMERIC_FOUND'; |
619 | 619 | } else { |
620 | 620 | // it's ok, add it on |
621 | - $this->_xh['value'] = (int)$this->_xh['ac']; |
|
621 | + $this->_xh['value'] = (int) $this->_xh['ac']; |
|
622 | 622 | } |
623 | 623 | break; |
624 | 624 | |
@@ -626,7 +626,7 @@ discard block |
||
626 | 626 | $this->_xh['vt'] = Value::$xmlrpcDouble; |
627 | 627 | $this->_xh['lv'] = 3; // indicate we've found a value |
628 | 628 | if (!preg_match(PhpXmlRpc::$xmlrpc_double_format, $this->_xh['ac'])) { |
629 | - if (!$this->handleParsingError('non numeric data received in DOUBLE value: ' . |
|
629 | + if (!$this->handleParsingError('non numeric data received in DOUBLE value: '. |
|
630 | 630 | $this->truncateValueForLog($this->_xh['ac']), __METHOD__)) { |
631 | 631 | return; |
632 | 632 | } |
@@ -634,7 +634,7 @@ discard block |
||
634 | 634 | $this->_xh['value'] = 'ERROR_NON_NUMERIC_FOUND'; |
635 | 635 | } else { |
636 | 636 | // it's ok, add it on |
637 | - $this->_xh['value'] = (double)$this->_xh['ac']; |
|
637 | + $this->_xh['value'] = (double) $this->_xh['ac']; |
|
638 | 638 | } |
639 | 639 | break; |
640 | 640 | |
@@ -642,7 +642,7 @@ discard block |
||
642 | 642 | $this->_xh['vt'] = Value::$xmlrpcDateTime; |
643 | 643 | $this->_xh['lv'] = 3; // indicate we've found a value |
644 | 644 | if (!preg_match(PhpXmlRpc::$xmlrpc_datetime_format, $this->_xh['ac'])) { |
645 | - if (!$this->handleParsingError('invalid data received in DATETIME value: ' . |
|
645 | + if (!$this->handleParsingError('invalid data received in DATETIME value: '. |
|
646 | 646 | $this->truncateValueForLog($this->_xh['ac']), __METHOD__)) { |
647 | 647 | return; |
648 | 648 | } |
@@ -653,9 +653,9 @@ discard block |
||
653 | 653 | |
654 | 654 | // the default regex used to validate the date string a few lines above should make this case impossible, |
655 | 655 | // but one never knows... |
656 | - } catch(\Exception $e) { |
|
656 | + } catch (\Exception $e) { |
|
657 | 657 | // what to do? We can not guarantee that a valid date can be created. We return null... |
658 | - if (!$this->handleParsingError('invalid data received in DATETIME value. Error ' . |
|
658 | + if (!$this->handleParsingError('invalid data received in DATETIME value. Error '. |
|
659 | 659 | $e->getMessage(), __METHOD__)) { |
660 | 660 | return; |
661 | 661 | } |
@@ -672,14 +672,14 @@ discard block |
||
672 | 672 | $v = base64_decode($this->_xh['ac'], true); |
673 | 673 | if ($v === false) { |
674 | 674 | $this->_xh['isf'] = 2; |
675 | - $this->_xh['isf_reason'] = 'Invalid data received in BASE64 value: '. $this->truncateValueForLog($this->_xh['ac']); |
|
675 | + $this->_xh['isf_reason'] = 'Invalid data received in BASE64 value: '.$this->truncateValueForLog($this->_xh['ac']); |
|
676 | 676 | return; |
677 | 677 | } |
678 | 678 | } else { |
679 | 679 | $v = base64_decode($this->_xh['ac']); |
680 | 680 | if ($v === '' && $this->_xh['ac'] !== '') { |
681 | 681 | // only the empty string should decode to the empty string |
682 | - $this->getLogger()->error('XML-RPC: ' . __METHOD__ . ': invalid data received in BASE64 value: ' . |
|
682 | + $this->getLogger()->error('XML-RPC: '.__METHOD__.': invalid data received in BASE64 value: '. |
|
683 | 683 | $this->truncateValueForLog($this->_xh['ac'])); |
684 | 684 | } |
685 | 685 | } |
@@ -687,20 +687,20 @@ discard block |
||
687 | 687 | break; |
688 | 688 | |
689 | 689 | case 'NAME': |
690 | - $this->_xh['valuestack'][count($this->_xh['valuestack']) - 1]['name'] = $this->_xh['ac']; |
|
690 | + $this->_xh['valuestack'][count($this->_xh['valuestack'])-1]['name'] = $this->_xh['ac']; |
|
691 | 691 | break; |
692 | 692 | |
693 | 693 | case 'MEMBER': |
694 | 694 | // add to array in the stack the last element built, unless no VALUE or no NAME were found |
695 | 695 | if ($this->_xh['vt']) { |
696 | 696 | $vscount = count($this->_xh['valuestack']); |
697 | - if ($this->_xh['valuestack'][$vscount - 1]['name'] === null) { |
|
697 | + if ($this->_xh['valuestack'][$vscount-1]['name'] === null) { |
|
698 | 698 | if (!$this->handleParsingError('missing NAME inside STRUCT in received xml', __METHOD__)) { |
699 | 699 | return; |
700 | 700 | } |
701 | - $this->_xh['valuestack'][$vscount - 1]['name'] = ''; |
|
701 | + $this->_xh['valuestack'][$vscount-1]['name'] = ''; |
|
702 | 702 | } |
703 | - $this->_xh['valuestack'][$vscount - 1]['values'][$this->_xh['valuestack'][$vscount - 1]['name']] = $this->_xh['value']; |
|
703 | + $this->_xh['valuestack'][$vscount-1]['values'][$this->_xh['valuestack'][$vscount-1]['name']] = $this->_xh['value']; |
|
704 | 704 | } else { |
705 | 705 | if (!$this->handleParsingError('missing VALUE inside STRUCT in received xml', __METHOD__)) { |
706 | 706 | return; |
@@ -816,7 +816,7 @@ discard block |
||
816 | 816 | public function xmlrpc_cd($parser, $data) |
817 | 817 | { |
818 | 818 | // skip processing if xml fault already detected |
819 | - if ($this->_xh['isf'] >= 2) { |
|
819 | + if ($this->_xh['isf']>=2) { |
|
820 | 820 | return; |
821 | 821 | } |
822 | 822 | |
@@ -838,7 +838,7 @@ discard block |
||
838 | 838 | public function xmlrpc_dh($parser, $data) |
839 | 839 | { |
840 | 840 | // skip processing if xml fault already detected |
841 | - if ($this->_xh['isf'] >= 2) { |
|
841 | + if ($this->_xh['isf']>=2) { |
|
842 | 842 | return; |
843 | 843 | } |
844 | 844 | |
@@ -912,8 +912,8 @@ discard block |
||
912 | 912 | // Details: |
913 | 913 | // SPACE: (#x20 | #x9 | #xD | #xA)+ === [ \x9\xD\xA]+ |
914 | 914 | // EQ: SPACE?=SPACE? === [ \x9\xD\xA]*=[ \x9\xD\xA]* |
915 | - if (preg_match('/^<\?xml\s+version\s*=\s*' . "((?:\"[a-zA-Z0-9_.:-]+\")|(?:'[a-zA-Z0-9_.:-]+'))" . |
|
916 | - '\s+encoding\s*=\s*' . "((?:\"[A-Za-z][A-Za-z0-9._-]*\")|(?:'[A-Za-z][A-Za-z0-9._-]*'))/", |
|
915 | + if (preg_match('/^<\?xml\s+version\s*=\s*'."((?:\"[a-zA-Z0-9_.:-]+\")|(?:'[a-zA-Z0-9_.:-]+'))". |
|
916 | + '\s+encoding\s*=\s*'."((?:\"[A-Za-z][A-Za-z0-9._-]*\")|(?:'[A-Za-z][A-Za-z0-9._-]*'))/", |
|
917 | 917 | $xmlChunk, $matches)) { |
918 | 918 | return strtoupper(substr($matches[2], 1, -1)); |
919 | 919 | } |
@@ -931,7 +931,7 @@ discard block |
||
931 | 931 | // NB: mb_detect likes to call it ascii, xml parser likes to call it US_ASCII... |
932 | 932 | // IANA also likes better US-ASCII, so go with it |
933 | 933 | if ($enc == 'ASCII') { |
934 | - $enc = 'US-' . $enc; |
|
934 | + $enc = 'US-'.$enc; |
|
935 | 935 | } |
936 | 936 | |
937 | 937 | return $enc; |
@@ -968,8 +968,8 @@ discard block |
||
968 | 968 | // Details: |
969 | 969 | // SPACE: (#x20 | #x9 | #xD | #xA)+ === [ \x9\xD\xA]+ |
970 | 970 | // EQ: SPACE?=SPACE? === [ \x9\xD\xA]*=[ \x9\xD\xA]* |
971 | - if (preg_match('/^<\?xml\s+version\s*=\s*' . "((?:\"[a-zA-Z0-9_.:-]+\")|(?:'[a-zA-Z0-9_.:-]+'))" . |
|
972 | - '\s+encoding\s*=\s*' . "((?:\"[A-Za-z][A-Za-z0-9._-]*\")|(?:'[A-Za-z][A-Za-z0-9._-]*'))/", |
|
971 | + if (preg_match('/^<\?xml\s+version\s*=\s*'."((?:\"[a-zA-Z0-9_.:-]+\")|(?:'[a-zA-Z0-9_.:-]+'))". |
|
972 | + '\s+encoding\s*=\s*'."((?:\"[A-Za-z][A-Za-z0-9._-]*\")|(?:'[A-Za-z][A-Za-z0-9._-]*'))/", |
|
973 | 973 | $xmlChunk)) { |
974 | 974 | return true; |
975 | 975 | } |
@@ -989,7 +989,7 @@ discard block |
||
989 | 989 | $this->_xh['isf_reason'] = ucfirst($message); |
990 | 990 | return false; |
991 | 991 | } else { |
992 | - $this->getLogger()->error('XML-RPC: ' . ($method != '' ? $method . ': ' : '') . $message); |
|
992 | + $this->getLogger()->error('XML-RPC: '.($method != '' ? $method.': ' : '').$message); |
|
993 | 993 | return true; |
994 | 994 | } |
995 | 995 | } |
@@ -1001,8 +1001,8 @@ discard block |
||
1001 | 1001 | */ |
1002 | 1002 | protected function truncateValueForLog($data) |
1003 | 1003 | { |
1004 | - if (strlen($data) > $this->maxLogValueLength) { |
|
1005 | - return substr($data, 0, $this->maxLogValueLength - 3) . '...'; |
|
1004 | + if (strlen($data)>$this->maxLogValueLength) { |
|
1005 | + return substr($data, 0, $this->maxLogValueLength-3).'...'; |
|
1006 | 1006 | } |
1007 | 1007 | |
1008 | 1008 | return $data; |
@@ -1015,13 +1015,13 @@ discard block |
||
1015 | 1015 | switch ($name) { |
1016 | 1016 | // this should only ever be called by subclasses which overtook `parse()` |
1017 | 1017 | case 'accept': |
1018 | - $this->logDeprecation('Setting property XMLParser::' . $name . ' is deprecated'); |
|
1018 | + $this->logDeprecation('Setting property XMLParser::'.$name.' is deprecated'); |
|
1019 | 1019 | $this->current_parsing_options['accept'] = $value; |
1020 | 1020 | break; |
1021 | 1021 | default: |
1022 | 1022 | /// @todo throw instead? There are very few other places where the lib trigger errors which can potentially reach stdout... |
1023 | 1023 | $trace = debug_backtrace(DEBUG_BACKTRACE_IGNORE_ARGS); |
1024 | - trigger_error('Undefined property via __set(): ' . $name . ' in ' . $trace[0]['file'] . ' on line ' . $trace[0]['line'], E_USER_WARNING); |
|
1024 | + trigger_error('Undefined property via __set(): '.$name.' in '.$trace[0]['file'].' on line '.$trace[0]['line'], E_USER_WARNING); |
|
1025 | 1025 | } |
1026 | 1026 | } |
1027 | 1027 | |
@@ -1029,7 +1029,7 @@ discard block |
||
1029 | 1029 | { |
1030 | 1030 | switch ($name) { |
1031 | 1031 | case 'accept': |
1032 | - $this->logDeprecation('Checking property XMLParser::' . $name . ' is deprecated'); |
|
1032 | + $this->logDeprecation('Checking property XMLParser::'.$name.' is deprecated'); |
|
1033 | 1033 | return isset($this->current_parsing_options['accept']); |
1034 | 1034 | default: |
1035 | 1035 | return false; |
@@ -1041,13 +1041,13 @@ discard block |
||
1041 | 1041 | switch ($name) { |
1042 | 1042 | // q: does this make sense at all? |
1043 | 1043 | case 'accept': |
1044 | - $this->logDeprecation('Unsetting property XMLParser::' . $name . ' is deprecated'); |
|
1044 | + $this->logDeprecation('Unsetting property XMLParser::'.$name.' is deprecated'); |
|
1045 | 1045 | unset($this->current_parsing_options['accept']); |
1046 | 1046 | break; |
1047 | 1047 | default: |
1048 | 1048 | /// @todo throw instead? There are very few other places where the lib trigger errors which can potentially reach stdout... |
1049 | 1049 | $trace = debug_backtrace(DEBUG_BACKTRACE_IGNORE_ARGS); |
1050 | - trigger_error('Undefined property via __unset(): ' . $name . ' in ' . $trace[0]['file'] . ' on line ' . $trace[0]['line'], E_USER_WARNING); |
|
1050 | + trigger_error('Undefined property via __unset(): '.$name.' in '.$trace[0]['file'].' on line '.$trace[0]['line'], E_USER_WARNING); |
|
1051 | 1051 | } |
1052 | 1052 | } |
1053 | 1053 | } |
@@ -96,7 +96,7 @@ discard block |
||
96 | 96 | $this->me['struct'] = $val; |
97 | 97 | break; |
98 | 98 | default: |
99 | - $this->getLogger()->error("XML-RPC: " . __METHOD__ . ": not a known type ($type)"); |
|
99 | + $this->getLogger()->error("XML-RPC: ".__METHOD__.": not a known type ($type)"); |
|
100 | 100 | } |
101 | 101 | } |
102 | 102 | } |
@@ -126,7 +126,7 @@ discard block |
||
126 | 126 | } |
127 | 127 | |
128 | 128 | if ($typeOf !== 1) { |
129 | - $this->getLogger()->error("XML-RPC: " . __METHOD__ . ": not a scalar type ($type)"); |
|
129 | + $this->getLogger()->error("XML-RPC: ".__METHOD__.": not a scalar type ($type)"); |
|
130 | 130 | return 0; |
131 | 131 | } |
132 | 132 | |
@@ -143,10 +143,10 @@ discard block |
||
143 | 143 | |
144 | 144 | switch ($this->mytype) { |
145 | 145 | case 1: |
146 | - $this->getLogger()->error('XML-RPC: ' . __METHOD__ . ': scalar xmlrpc value can have only one value'); |
|
146 | + $this->getLogger()->error('XML-RPC: '.__METHOD__.': scalar xmlrpc value can have only one value'); |
|
147 | 147 | return 0; |
148 | 148 | case 3: |
149 | - $this->getLogger()->error('XML-RPC: ' . __METHOD__ . ': cannot add anonymous scalar to struct xmlrpc value'); |
|
149 | + $this->getLogger()->error('XML-RPC: '.__METHOD__.': cannot add anonymous scalar to struct xmlrpc value'); |
|
150 | 150 | return 0; |
151 | 151 | case 2: |
152 | 152 | // we're adding a scalar value to an array here |
@@ -190,7 +190,7 @@ discard block |
||
190 | 190 | |
191 | 191 | return 1; |
192 | 192 | } else { |
193 | - $this->getLogger()->error('XML-RPC: ' . __METHOD__ . ': already initialized as a [' . $this->kindOf() . ']'); |
|
193 | + $this->getLogger()->error('XML-RPC: '.__METHOD__.': already initialized as a ['.$this->kindOf().']'); |
|
194 | 194 | return 0; |
195 | 195 | } |
196 | 196 | } |
@@ -221,7 +221,7 @@ discard block |
||
221 | 221 | |
222 | 222 | return 1; |
223 | 223 | } else { |
224 | - $this->getLogger()->error('XML-RPC: ' . __METHOD__ . ': already initialized as a [' . $this->kindOf() . ']'); |
|
224 | + $this->getLogger()->error('XML-RPC: '.__METHOD__.': already initialized as a ['.$this->kindOf().']'); |
|
225 | 225 | return 0; |
226 | 226 | } |
227 | 227 | } |
@@ -265,19 +265,19 @@ discard block |
||
265 | 265 | case 1: |
266 | 266 | switch ($typ) { |
267 | 267 | case static::$xmlrpcBase64: |
268 | - $rs .= "<{$typ}>" . base64_encode($val) . "</{$typ}>"; |
|
268 | + $rs .= "<{$typ}>".base64_encode($val)."</{$typ}>"; |
|
269 | 269 | break; |
270 | 270 | case static::$xmlrpcBoolean: |
271 | - $rs .= "<{$typ}>" . ($val ? '1' : '0') . "</{$typ}>"; |
|
271 | + $rs .= "<{$typ}>".($val ? '1' : '0')."</{$typ}>"; |
|
272 | 272 | break; |
273 | 273 | case static::$xmlrpcString: |
274 | 274 | // Do NOT use htmlentities, since it will produce named html entities, which are invalid xml |
275 | - $rs .= "<{$typ}>" . $this->getCharsetEncoder()->encodeEntities($val, PhpXmlRpc::$xmlrpc_internalencoding, $charsetEncoding) . "</{$typ}>"; |
|
275 | + $rs .= "<{$typ}>".$this->getCharsetEncoder()->encodeEntities($val, PhpXmlRpc::$xmlrpc_internalencoding, $charsetEncoding)."</{$typ}>"; |
|
276 | 276 | break; |
277 | 277 | case static::$xmlrpcInt: |
278 | 278 | case static::$xmlrpcI4: |
279 | 279 | case static::$xmlrpcI8: |
280 | - $rs .= "<{$typ}>" . (int)$val . "</{$typ}>"; |
|
280 | + $rs .= "<{$typ}>".(int) $val."</{$typ}>"; |
|
281 | 281 | break; |
282 | 282 | case static::$xmlrpcDouble: |
283 | 283 | // avoid using standard conversion of float to string because it is locale-dependent, |
@@ -285,16 +285,16 @@ discard block |
||
285 | 285 | // sprintf('%F') could be most likely ok, but it fails e.g. on 2e-14. |
286 | 286 | // The code below tries its best at keeping max precision while avoiding exp notation, |
287 | 287 | // but there is of course no limit in the number of decimal places to be used... |
288 | - $rs .= "<{$typ}>" . preg_replace('/\\.?0+$/', '', number_format((double)$val, PhpXmlRpc::$xmlpc_double_precision, '.', '')) . "</{$typ}>"; |
|
288 | + $rs .= "<{$typ}>".preg_replace('/\\.?0+$/', '', number_format((double) $val, PhpXmlRpc::$xmlpc_double_precision, '.', ''))."</{$typ}>"; |
|
289 | 289 | break; |
290 | 290 | case static::$xmlrpcDateTime: |
291 | 291 | if (is_string($val)) { |
292 | 292 | $rs .= "<{$typ}>{$val}</{$typ}>"; |
293 | 293 | // DateTimeInterface is not present in php 5.4... |
294 | 294 | } elseif (is_a($val, 'DateTimeInterface') || is_a($val, 'DateTime')) { |
295 | - $rs .= "<{$typ}>" . $val->format('Ymd\TH:i:s') . "</{$typ}>"; |
|
295 | + $rs .= "<{$typ}>".$val->format('Ymd\TH:i:s')."</{$typ}>"; |
|
296 | 296 | } elseif (is_int($val)) { |
297 | - $rs .= "<{$typ}>" . date('Ymd\TH:i:s', $val) . "</{$typ}>"; |
|
297 | + $rs .= "<{$typ}>".date('Ymd\TH:i:s', $val)."</{$typ}>"; |
|
298 | 298 | } else { |
299 | 299 | // not really a good idea here: but what should we output anyway? left for backward compat... |
300 | 300 | $rs .= "<{$typ}>{$val}</{$typ}>"; |
@@ -316,14 +316,14 @@ discard block |
||
316 | 316 | case 3: |
317 | 317 | // struct |
318 | 318 | if ($this->_php_class) { |
319 | - $rs .= '<struct php_class="' . $this->_php_class . "\">\n"; |
|
319 | + $rs .= '<struct php_class="'.$this->_php_class."\">\n"; |
|
320 | 320 | } else { |
321 | 321 | $rs .= "<struct>\n"; |
322 | 322 | } |
323 | 323 | $charsetEncoder = $this->getCharsetEncoder(); |
324 | 324 | /** @var Value $val2 */ |
325 | 325 | foreach ($val as $key2 => $val2) { |
326 | - $rs .= '<member><name>' . $charsetEncoder->encodeEntities($key2, PhpXmlRpc::$xmlrpc_internalencoding, $charsetEncoding) . "</name>\n"; |
|
326 | + $rs .= '<member><name>'.$charsetEncoder->encodeEntities($key2, PhpXmlRpc::$xmlrpc_internalencoding, $charsetEncoding)."</name>\n"; |
|
327 | 327 | //$rs.=$this->serializeval($val2); |
328 | 328 | $rs .= $val2->serialize($charsetEncoding); |
329 | 329 | $rs .= "</member>\n"; |
@@ -358,7 +358,7 @@ discard block |
||
358 | 358 | $val = reset($this->me); |
359 | 359 | $typ = key($this->me); |
360 | 360 | |
361 | - return '<value>' . $this->serializeData($typ, $val, $charsetEncoding) . "</value>\n"; |
|
361 | + return '<value>'.$this->serializeData($typ, $val, $charsetEncoding)."</value>\n"; |
|
362 | 362 | } |
363 | 363 | |
364 | 364 | /** |
@@ -373,7 +373,7 @@ discard block |
||
373 | 373 | */ |
374 | 374 | public function structMemExists($key) |
375 | 375 | { |
376 | - $this->logDeprecation('Method ' . __METHOD__ . ' is deprecated'); |
|
376 | + $this->logDeprecation('Method '.__METHOD__.' is deprecated'); |
|
377 | 377 | |
378 | 378 | return array_key_exists($key, $this->me['struct']); |
379 | 379 | } |
@@ -389,7 +389,7 @@ discard block |
||
389 | 389 | */ |
390 | 390 | public function structMem($key) |
391 | 391 | { |
392 | - $this->logDeprecation('Method ' . __METHOD__ . ' is deprecated'); |
|
392 | + $this->logDeprecation('Method '.__METHOD__.' is deprecated'); |
|
393 | 393 | |
394 | 394 | return $this->me['struct'][$key]; |
395 | 395 | } |
@@ -402,7 +402,7 @@ discard block |
||
402 | 402 | */ |
403 | 403 | public function structReset() |
404 | 404 | { |
405 | - $this->logDeprecation('Method ' . __METHOD__ . ' is deprecated'); |
|
405 | + $this->logDeprecation('Method '.__METHOD__.' is deprecated'); |
|
406 | 406 | |
407 | 407 | reset($this->me['struct']); |
408 | 408 | } |
@@ -417,7 +417,7 @@ discard block |
||
417 | 417 | */ |
418 | 418 | public function structEach() |
419 | 419 | { |
420 | - $this->logDeprecation('Method ' . __METHOD__ . ' is deprecated'); |
|
420 | + $this->logDeprecation('Method '.__METHOD__.' is deprecated'); |
|
421 | 421 | |
422 | 422 | return @each($this->me['struct']); |
423 | 423 | } |
@@ -462,7 +462,7 @@ discard block |
||
462 | 462 | */ |
463 | 463 | public function arrayMem($key) |
464 | 464 | { |
465 | - $this->logDeprecation('Method ' . __METHOD__ . ' is deprecated'); |
|
465 | + $this->logDeprecation('Method '.__METHOD__.' is deprecated'); |
|
466 | 466 | |
467 | 467 | return $this->me['array'][$key]; |
468 | 468 | } |
@@ -476,7 +476,7 @@ discard block |
||
476 | 476 | */ |
477 | 477 | public function arraySize() |
478 | 478 | { |
479 | - $this->logDeprecation('Method ' . __METHOD__ . ' is deprecated'); |
|
479 | + $this->logDeprecation('Method '.__METHOD__.' is deprecated'); |
|
480 | 480 | |
481 | 481 | return count($this->me['array']); |
482 | 482 | } |
@@ -490,7 +490,7 @@ discard block |
||
490 | 490 | */ |
491 | 491 | public function structSize() |
492 | 492 | { |
493 | - $this->logDeprecation('Method ' . __METHOD__ . ' is deprecated'); |
|
493 | + $this->logDeprecation('Method '.__METHOD__.' is deprecated'); |
|
494 | 494 | |
495 | 495 | return count($this->me['struct']); |
496 | 496 | } |
@@ -14,6 +14,6 @@ |
||
14 | 14 | return; |
15 | 15 | } |
16 | 16 | |
17 | - $this->getLogger()->warning('XML-RPC Deprecated: ' . $message); |
|
17 | + $this->getLogger()->warning('XML-RPC Deprecated: '.$message); |
|
18 | 18 | } |
19 | 19 | } |