@@ -26,12 +26,12 @@ discard block |
||
| 26 | 26 | |
| 27 | 27 | // read chunk-size, chunk-extension (if any) and crlf |
| 28 | 28 | // get the position of the linebreak |
| 29 | - $chunkEnd = strpos($buffer, "\r\n") + 2; |
|
| 29 | + $chunkEnd = strpos($buffer, "\r\n")+2; |
|
| 30 | 30 | $temp = substr($buffer, 0, $chunkEnd); |
| 31 | 31 | $chunkSize = hexdec(trim($temp)); |
| 32 | 32 | $chunkStart = $chunkEnd; |
| 33 | - while ($chunkSize > 0) { |
|
| 34 | - $chunkEnd = strpos($buffer, "\r\n", $chunkStart + $chunkSize); |
|
| 33 | + while ($chunkSize>0) { |
|
| 34 | + $chunkEnd = strpos($buffer, "\r\n", $chunkStart+$chunkSize); |
|
| 35 | 35 | |
| 36 | 36 | // just in case we got a broken connection |
| 37 | 37 | if ($chunkEnd == false) { |
@@ -43,19 +43,19 @@ discard block |
||
| 43 | 43 | } |
| 44 | 44 | |
| 45 | 45 | // read chunk-data and crlf |
| 46 | - $chunk = substr($buffer, $chunkStart, $chunkEnd - $chunkStart); |
|
| 46 | + $chunk = substr($buffer, $chunkStart, $chunkEnd-$chunkStart); |
|
| 47 | 47 | // append chunk-data to entity-body |
| 48 | 48 | $new .= $chunk; |
| 49 | 49 | // length := length + chunk-size |
| 50 | 50 | $length += strlen($chunk); |
| 51 | 51 | // read chunk-size and crlf |
| 52 | - $chunkStart = $chunkEnd + 2; |
|
| 52 | + $chunkStart = $chunkEnd+2; |
|
| 53 | 53 | |
| 54 | - $chunkEnd = strpos($buffer, "\r\n", $chunkStart) + 2; |
|
| 54 | + $chunkEnd = strpos($buffer, "\r\n", $chunkStart)+2; |
|
| 55 | 55 | if ($chunkEnd == false) { |
| 56 | 56 | break; // just in case we got a broken connection |
| 57 | 57 | } |
| 58 | - $temp = substr($buffer, $chunkStart, $chunkEnd - $chunkStart); |
|
| 58 | + $temp = substr($buffer, $chunkStart, $chunkEnd-$chunkStart); |
|
| 59 | 59 | $chunkSize = hexdec(trim($temp)); |
| 60 | 60 | $chunkStart = $chunkEnd; |
| 61 | 61 | } |
@@ -84,11 +84,11 @@ discard block |
||
| 84 | 84 | // Look for CR/LF or simple LF as line separator (even though it is not valid http) |
| 85 | 85 | $pos = strpos($data, "\r\n\r\n"); |
| 86 | 86 | if ($pos || is_int($pos)) { |
| 87 | - $bd = $pos + 4; |
|
| 87 | + $bd = $pos+4; |
|
| 88 | 88 | } else { |
| 89 | 89 | $pos = strpos($data, "\n\n"); |
| 90 | 90 | if ($pos || is_int($pos)) { |
| 91 | - $bd = $pos + 2; |
|
| 91 | + $bd = $pos+2; |
|
| 92 | 92 | } else { |
| 93 | 93 | // No separation between response headers and body: fault? |
| 94 | 94 | $bd = 0; |
@@ -98,8 +98,8 @@ discard block |
||
| 98 | 98 | // this filters out all http headers from proxy. maybe we could take them into account, too? |
| 99 | 99 | $data = substr($data, $bd); |
| 100 | 100 | } else { |
| 101 | - $this->getLogger()->error('XML-RPC: ' . __METHOD__ . ': HTTPS via proxy error, tunnel connection possibly failed'); |
|
| 102 | - throw new HttpException(PhpXmlRpc::$xmlrpcstr['http_error'] . ' (HTTPS via proxy error, tunnel connection possibly failed)', PhpXmlRpc::$xmlrpcerr['http_error']); |
|
| 101 | + $this->getLogger()->error('XML-RPC: '.__METHOD__.': HTTPS via proxy error, tunnel connection possibly failed'); |
|
| 102 | + throw new HttpException(PhpXmlRpc::$xmlrpcstr['http_error'].' (HTTPS via proxy error, tunnel connection possibly failed)', PhpXmlRpc::$xmlrpcerr['http_error']); |
|
| 103 | 103 | } |
| 104 | 104 | } |
| 105 | 105 | |
@@ -132,19 +132,19 @@ discard block |
||
| 132 | 132 | } |
| 133 | 133 | |
| 134 | 134 | if ($httpResponse['status_code'] !== '200') { |
| 135 | - $errstr = substr($data, 0, strpos($data, "\n") - 1); |
|
| 136 | - $this->getLogger()->error('XML-RPC: ' . __METHOD__ . ': HTTP error, got response: ' . $errstr); |
|
| 137 | - throw new HttpException(PhpXmlRpc::$xmlrpcstr['http_error'] . ' (' . $errstr . ')', PhpXmlRpc::$xmlrpcerr['http_error'], null, $httpResponse['status_code']); |
|
| 135 | + $errstr = substr($data, 0, strpos($data, "\n")-1); |
|
| 136 | + $this->getLogger()->error('XML-RPC: '.__METHOD__.': HTTP error, got response: '.$errstr); |
|
| 137 | + throw new HttpException(PhpXmlRpc::$xmlrpcstr['http_error'].' ('.$errstr.')', PhpXmlRpc::$xmlrpcerr['http_error'], null, $httpResponse['status_code']); |
|
| 138 | 138 | } |
| 139 | 139 | |
| 140 | 140 | // be tolerant to usage of \n instead of \r\n to separate headers and data (even though it is not valid http) |
| 141 | 141 | $pos = strpos($data, "\r\n\r\n"); |
| 142 | 142 | if ($pos || is_int($pos)) { |
| 143 | - $bd = $pos + 4; |
|
| 143 | + $bd = $pos+4; |
|
| 144 | 144 | } else { |
| 145 | 145 | $pos = strpos($data, "\n\n"); |
| 146 | 146 | if ($pos || is_int($pos)) { |
| 147 | - $bd = $pos + 2; |
|
| 147 | + $bd = $pos+2; |
|
| 148 | 148 | } else { |
| 149 | 149 | // No separation between response headers and body: fault? |
| 150 | 150 | // we could take some action here instead of going on... |
@@ -158,7 +158,7 @@ discard block |
||
| 158 | 158 | foreach ($ar as $line) { |
| 159 | 159 | // take care of (multi-line) headers and cookies |
| 160 | 160 | $arr = explode(':', $line, 2); |
| 161 | - if (count($arr) > 1) { |
|
| 161 | + if (count($arr)>1) { |
|
| 162 | 162 | /// @todo according to https://www.rfc-editor.org/rfc/rfc7230#section-3.2.4, we should reject with error |
| 163 | 163 | /// 400 any messages where a space is present between the header name and colon |
| 164 | 164 | $headerName = strtolower(trim($arr[0])); |
@@ -166,7 +166,7 @@ discard block |
||
| 166 | 166 | $cookie = $arr[1]; |
| 167 | 167 | // glue together all received cookies, using a comma to separate them (same as php does with getallheaders()) |
| 168 | 168 | if (isset($httpResponse['headers'][$headerName])) { |
| 169 | - $httpResponse['headers'][$headerName] .= ', ' . trim($cookie); |
|
| 169 | + $httpResponse['headers'][$headerName] .= ', '.trim($cookie); |
|
| 170 | 170 | } else { |
| 171 | 171 | $httpResponse['headers'][$headerName] = trim($cookie); |
| 172 | 172 | } |
@@ -197,7 +197,7 @@ discard block |
||
| 197 | 197 | } elseif (isset($headerName)) { |
| 198 | 198 | /// @todo improve this: 1. check that the line starts with a space or tab; 2. according to |
| 199 | 199 | /// https://www.rfc-editor.org/rfc/rfc7230#section-3.2.4, we should flat out refuse these messages |
| 200 | - $httpResponse['headers'][$headerName] .= ' ' . trim($line); |
|
| 200 | + $httpResponse['headers'][$headerName] .= ' '.trim($line); |
|
| 201 | 201 | } |
| 202 | 202 | } |
| 203 | 203 | |
@@ -220,7 +220,7 @@ discard block |
||
| 220 | 220 | // Decode chunked encoding sent by http 1.1 servers |
| 221 | 221 | if (isset($httpResponse['headers']['transfer-encoding']) && $httpResponse['headers']['transfer-encoding'] == 'chunked') { |
| 222 | 222 | if (!$data = static::decodeChunked($data)) { |
| 223 | - $this->getLogger()->error('XML-RPC: ' . __METHOD__ . ': errors occurred when trying to rebuild the chunked data received from server'); |
|
| 223 | + $this->getLogger()->error('XML-RPC: '.__METHOD__.': errors occurred when trying to rebuild the chunked data received from server'); |
|
| 224 | 224 | throw new HttpException(PhpXmlRpc::$xmlrpcstr['dechunk_fail'], PhpXmlRpc::$xmlrpcerr['dechunk_fail'], null, $httpResponse['status_code']); |
| 225 | 225 | } |
| 226 | 226 | } |
@@ -235,19 +235,19 @@ discard block |
||
| 235 | 235 | if ($httpResponse['headers']['content-encoding'] == 'deflate' && $degzdata = @gzuncompress($data)) { |
| 236 | 236 | $data = $degzdata; |
| 237 | 237 | if ($debug) { |
| 238 | - $this->getLogger()->debug("---INFLATED RESPONSE---[" . strlen($data) . " chars]---\n$data\n---END---"); |
|
| 238 | + $this->getLogger()->debug("---INFLATED RESPONSE---[".strlen($data)." chars]---\n$data\n---END---"); |
|
| 239 | 239 | } |
| 240 | 240 | } elseif ($httpResponse['headers']['content-encoding'] == 'gzip' && $degzdata = @gzinflate(substr($data, 10))) { |
| 241 | 241 | $data = $degzdata; |
| 242 | 242 | if ($debug) { |
| 243 | - $this->getLogger()->debug("---INFLATED RESPONSE---[" . strlen($data) . " chars]---\n$data\n---END---"); |
|
| 243 | + $this->getLogger()->debug("---INFLATED RESPONSE---[".strlen($data)." chars]---\n$data\n---END---"); |
|
| 244 | 244 | } |
| 245 | 245 | } else { |
| 246 | - $this->getLogger()->error('XML-RPC: ' . __METHOD__ . ': errors occurred when trying to decode the deflated data received from server'); |
|
| 246 | + $this->getLogger()->error('XML-RPC: '.__METHOD__.': errors occurred when trying to decode the deflated data received from server'); |
|
| 247 | 247 | throw new HttpException(PhpXmlRpc::$xmlrpcstr['decompress_fail'], PhpXmlRpc::$xmlrpcerr['decompress_fail'], null, $httpResponse['status_code']); |
| 248 | 248 | } |
| 249 | 249 | } else { |
| 250 | - $this->getLogger()->error('XML-RPC: ' . __METHOD__ . ': the server sent deflated data. Your php install must have the Zlib extension compiled in to support this.'); |
|
| 250 | + $this->getLogger()->error('XML-RPC: '.__METHOD__.': the server sent deflated data. Your php install must have the Zlib extension compiled in to support this.'); |
|
| 251 | 251 | throw new HttpException(PhpXmlRpc::$xmlrpcstr['cannot_decompress'], PhpXmlRpc::$xmlrpcerr['cannot_decompress'], null, $httpResponse['status_code']); |
| 252 | 252 | } |
| 253 | 253 | } |
@@ -267,7 +267,7 @@ discard block |
||
| 267 | 267 | public function parseAcceptHeader($header) |
| 268 | 268 | { |
| 269 | 269 | $accepted = array(); |
| 270 | - foreach(explode(',', $header) as $c) { |
|
| 270 | + foreach (explode(',', $header) as $c) { |
|
| 271 | 271 | if (preg_match('/^([^;]+); *q=([0-9.]+)/', $c, $matches)) { |
| 272 | 272 | $c = $matches[1]; |
| 273 | 273 | $w = $matches[2]; |
@@ -41,10 +41,10 @@ discard block |
||
| 41 | 41 | * @param array $extraOptions |
| 42 | 42 | * @return array|false |
| 43 | 43 | */ |
| 44 | -function wrap_php_function($funcName, $newFuncName='', $extraOptions=array()) |
|
| 44 | +function wrap_php_function($funcName, $newFuncName = '', $extraOptions = array()) |
|
| 45 | 45 | { |
| 46 | 46 | $wrapper = new PhpXmlRpc\Wrapper(); |
| 47 | - if (!isset($extraOptions['return_source']) || $extraOptions['return_source'] == false) { |
|
| 47 | + if (!isset($extraOptions['return_source']) || $extraOptions['return_source'] == false) { |
|
| 48 | 48 | // backwards compat: return string instead of callable |
| 49 | 49 | $extraOptions['return_source'] = true; |
| 50 | 50 | $wrapped = $wrapper->wrapPhpFunction($funcName, $newFuncName, $extraOptions); |
@@ -64,17 +64,17 @@ discard block |
||
| 64 | 64 | * @param array $extraOptions |
| 65 | 65 | * @return array|false |
| 66 | 66 | */ |
| 67 | -function wrap_php_class($className, $extraOptions=array()) |
|
| 67 | +function wrap_php_class($className, $extraOptions = array()) |
|
| 68 | 68 | { |
| 69 | 69 | $wrapper = new PhpXmlRpc\Wrapper(); |
| 70 | 70 | $fix = false; |
| 71 | - if (!isset($extraOptions['return_source']) || $extraOptions['return_source'] == false) { |
|
| 71 | + if (!isset($extraOptions['return_source']) || $extraOptions['return_source'] == false) { |
|
| 72 | 72 | // backwards compat: return string instead of callable |
| 73 | 73 | $extraOptions['return_source'] = true; |
| 74 | 74 | $fix = true; |
| 75 | 75 | } |
| 76 | 76 | $wrapped = $wrapper->wrapPhpClass($className, $extraOptions); |
| 77 | - foreach($wrapped as $name => $value) { |
|
| 77 | + foreach ($wrapped as $name => $value) { |
|
| 78 | 78 | if ($fix) { |
| 79 | 79 | eval($value['source']); |
| 80 | 80 | } |
@@ -93,7 +93,7 @@ discard block |
||
| 93 | 93 | * @param string $newFuncName deprecated, use an option in $extraOptions |
| 94 | 94 | * @return array|callable|false |
| 95 | 95 | */ |
| 96 | -function wrap_xmlrpc_method($client, $methodName, $extraOptions=0, $timeout=0, $protocol='', $newFuncName='') |
|
| 96 | +function wrap_xmlrpc_method($client, $methodName, $extraOptions = 0, $timeout = 0, $protocol = '', $newFuncName = '') |
|
| 97 | 97 | { |
| 98 | 98 | if (!is_array($extraOptions)) |
| 99 | 99 | { |
@@ -128,7 +128,7 @@ discard block |
||
| 128 | 128 | * @param array $extraOptions |
| 129 | 129 | * @return mixed |
| 130 | 130 | */ |
| 131 | -function wrap_xmlrpc_server($client, $extraOptions=array()) |
|
| 131 | +function wrap_xmlrpc_server($client, $extraOptions = array()) |
|
| 132 | 132 | { |
| 133 | 133 | $wrapper = new PhpXmlRpc\Wrapper(); |
| 134 | 134 | return $wrapper->wrapXmlrpcServer($client, $extraOptions); |
@@ -148,7 +148,7 @@ discard block |
||
| 148 | 148 | $faultResponse = '', $namespace = '\\PhpXmlRpc\\') |
| 149 | 149 | { |
| 150 | 150 | $code = "function $xmlrpcFuncName ("; |
| 151 | - if ($clientCopyMode < 2) { |
|
| 151 | + if ($clientCopyMode<2) { |
|
| 152 | 152 | // client copy mode 0 or 1 == partial / full client copy in emitted code |
| 153 | 153 | $innerCode = build_client_wrapper_code($client, $clientCopyMode, $prefix); |
| 154 | 154 | $innerCode .= "\$client->setDebug(\$debug);\n"; |
@@ -162,7 +162,7 @@ discard block |
||
| 162 | 162 | |
| 163 | 163 | if ($mDesc != '') { |
| 164 | 164 | // take care that PHP comment is not terminated unwillingly by method description |
| 165 | - $mDesc = "/**\n* " . str_replace('*/', '* /', $mDesc) . "\n"; |
|
| 165 | + $mDesc = "/**\n* ".str_replace('*/', '* /', $mDesc)."\n"; |
|
| 166 | 166 | } else { |
| 167 | 167 | $mDesc = "/**\nFunction $xmlrpcFuncName\n"; |
| 168 | 168 | } |
@@ -171,7 +171,7 @@ discard block |
||
| 171 | 171 | $innerCode .= "\$encoder = new {$namespace}Encoder();\n"; |
| 172 | 172 | $plist = array(); |
| 173 | 173 | $pCount = count($mSig); |
| 174 | - for ($i = 1; $i < $pCount; $i++) { |
|
| 174 | + for ($i = 1; $i<$pCount; $i++) { |
|
| 175 | 175 | $plist[] = "\$p$i"; |
| 176 | 176 | $pType = $mSig[$i]; |
| 177 | 177 | if ($pType == 'i4' || $pType == 'i8' || $pType == 'int' || $pType == 'boolean' || $pType == 'double' || |
@@ -187,19 +187,19 @@ discard block |
||
| 187 | 187 | } |
| 188 | 188 | } |
| 189 | 189 | $innerCode .= "\$req->addparam(\$p$i);\n"; |
| 190 | - $mDesc .= '* @param ' . xmlrpc_2_php_type($pType) . " \$p$i\n"; |
|
| 190 | + $mDesc .= '* @param '.xmlrpc_2_php_type($pType)." \$p$i\n"; |
|
| 191 | 191 | } |
| 192 | - if ($clientCopyMode < 2) { |
|
| 192 | + if ($clientCopyMode<2) { |
|
| 193 | 193 | $plist[] = '$debug=0'; |
| 194 | 194 | $mDesc .= "* @param int \$debug when 1 (or 2) will enable debugging of the underlying {$prefix} call (defaults to 0)\n"; |
| 195 | 195 | } |
| 196 | 196 | $plist = implode(', ', $plist); |
| 197 | - $mDesc .= '* @return ' . xmlrpc_2_php_type($mSig[0]) . " (or an {$namespace}Response obj instance if call fails)\n*/\n"; |
|
| 197 | + $mDesc .= '* @return '.xmlrpc_2_php_type($mSig[0])." (or an {$namespace}Response obj instance if call fails)\n*/\n"; |
|
| 198 | 198 | |
| 199 | 199 | $innerCode .= "\$res = \${$this_}client->send(\$req, $timeout, '$protocol');\n"; |
| 200 | 200 | if ($decodeFault) { |
| 201 | 201 | if (is_string($faultResponse) && ((strpos($faultResponse, '%faultCode%') !== false) || (strpos($faultResponse, '%faultString%') !== false))) { |
| 202 | - $respCode = "str_replace(array('%faultCode%', '%faultString%'), array(\$res->faultCode(), \$res->faultString()), '" . str_replace("'", "''", $faultResponse) . "')"; |
|
| 202 | + $respCode = "str_replace(array('%faultCode%', '%faultString%'), array(\$res->faultCode(), \$res->faultString()), '".str_replace("'", "''", $faultResponse)."')"; |
|
| 203 | 203 | } else { |
| 204 | 204 | $respCode = var_export($faultResponse, true); |
| 205 | 205 | } |
@@ -212,7 +212,7 @@ discard block |
||
| 212 | 212 | $innerCode .= "if (\$res->faultcode()) return $respCode; else return \$encoder->decode(\$res->value());"; |
| 213 | 213 | } |
| 214 | 214 | |
| 215 | - $code = $code . $plist . ") {\n" . $innerCode . "\n}\n"; |
|
| 215 | + $code = $code.$plist.") {\n".$innerCode."\n}\n"; |
|
| 216 | 216 | |
| 217 | 217 | return array('source' => $code, 'docstring' => $mDesc); |
| 218 | 218 | } |
@@ -220,10 +220,10 @@ discard block |
||
| 220 | 220 | /** |
| 221 | 221 | * @deprecated |
| 222 | 222 | */ |
| 223 | -function build_client_wrapper_code($client, $verbatim_client_copy, $prefix='xmlrpc') |
|
| 223 | +function build_client_wrapper_code($client, $verbatim_client_copy, $prefix = 'xmlrpc') |
|
| 224 | 224 | { |
| 225 | 225 | $code = "\$client = new {$prefix}_client('".str_replace("'", "\'", $client->path). |
| 226 | - "', '" . str_replace("'", "\'", $client->server) . "', $client->port);\n"; |
|
| 226 | + "', '".str_replace("'", "\'", $client->server)."', $client->port);\n"; |
|
| 227 | 227 | |
| 228 | 228 | // copy all client fields to the client that will be generated runtime |
| 229 | 229 | // (this provides for future expansion or subclassing of client obj) |
@@ -1,6 +1,6 @@ |
||
| 1 | 1 | <?php |
| 2 | 2 | |
| 3 | -include_once __DIR__ . '/LoggerAwareTestCase.php'; |
|
| 3 | +include_once __DIR__.'/LoggerAwareTestCase.php'; |
|
| 4 | 4 | |
| 5 | 5 | /** |
| 6 | 6 | * Tests involving Requests and Responses, except for the parsing part |
@@ -1,6 +1,6 @@ discard block |
||
| 1 | 1 | <?php |
| 2 | 2 | |
| 3 | -include_once __DIR__ . '/LoggerAwareTestCase.php'; |
|
| 3 | +include_once __DIR__.'/LoggerAwareTestCase.php'; |
|
| 4 | 4 | |
| 5 | 5 | /** |
| 6 | 6 | * Tests involving automatic encoding/decoding of php values into xmlrpc values (the Encoder class). |
@@ -75,7 +75,7 @@ discard block |
||
| 75 | 75 | /// @todo it seems that old php versions can not automatically transform latin to utf8 upon xml parsing. |
| 76 | 76 | /// We should fix that, then re-enable this test |
| 77 | 77 | if (version_compare(PHP_VERSION, '5.6.0', '>=')) { |
| 78 | - $i = $e->decodeXml('<?xml version="1.0" encoding="ISO-8859-15" ?><value><string>' . $string . '</string></value>'); |
|
| 78 | + $i = $e->decodeXml('<?xml version="1.0" encoding="ISO-8859-15" ?><value><string>'.$string.'</string></value>'); |
|
| 79 | 79 | $this->assertEquals($string, $i->scalarVal()); |
| 80 | 80 | } |
| 81 | 81 | |
@@ -1,6 +1,6 @@ discard block |
||
| 1 | 1 | <?php |
| 2 | 2 | |
| 3 | -include_once __DIR__ . '/LoggerAwareTestCase.php'; |
|
| 3 | +include_once __DIR__.'/LoggerAwareTestCase.php'; |
|
| 4 | 4 | |
| 5 | 5 | /** |
| 6 | 6 | * Tests involving the Client class (and no server). |
@@ -35,7 +35,7 @@ discard block |
||
| 35 | 35 | $this->client->server .= 'XXX'; |
| 36 | 36 | $dnsinfo = @dns_get_record($this->client->server); |
| 37 | 37 | if ($dnsinfo) { |
| 38 | - $this->markTestSkipped('Seems like there is a catchall DNS in effect: host ' . $this->client->server . ' found'); |
|
| 38 | + $this->markTestSkipped('Seems like there is a catchall DNS in effect: host '.$this->client->server.' found'); |
|
| 39 | 39 | } else { |
| 40 | 40 | $r = $this->client->send($m, 5); |
| 41 | 41 | // make sure there's no freaking catchall DNS in effect |
@@ -62,7 +62,7 @@ discard block |
||
| 62 | 62 | |
| 63 | 63 | // now test a successful connection |
| 64 | 64 | $server = explode(':', $this->args['HTTPSERVER']); |
| 65 | - if (count($server) > 1) { |
|
| 65 | + if (count($server)>1) { |
|
| 66 | 66 | $this->client->port = $server[1]; |
| 67 | 67 | } |
| 68 | 68 | $this->client->server = $server[0]; |
@@ -1,6 +1,6 @@ discard block |
||
| 1 | 1 | <?php |
| 2 | 2 | |
| 3 | -include_once __DIR__ . '/LoggerAwareTestCase.php'; |
|
| 3 | +include_once __DIR__.'/LoggerAwareTestCase.php'; |
|
| 4 | 4 | |
| 5 | 5 | /** |
| 6 | 6 | * Tests involving the Value class. |
@@ -155,7 +155,7 @@ discard block |
||
| 155 | 155 | $this->assertequals(1, count($v1)); |
| 156 | 156 | $out = array('me' => array(), 'mytype' => 2, '_php_class' => null); |
| 157 | 157 | |
| 158 | - foreach($v1 as $key => $val) |
|
| 158 | + foreach ($v1 as $key => $val) |
|
| 159 | 159 | { |
| 160 | 160 | $this->assertArrayHasKey($key, $out); |
| 161 | 161 | $expected = $out[$key]; |
@@ -170,7 +170,7 @@ discard block |
||
| 170 | 170 | $this->assertequals(2, count($v2)); |
| 171 | 171 | $out = array(array('key' => 0, 'value' => 'object'), array('key' => 1, 'value' => 'object')); |
| 172 | 172 | $i = 0; |
| 173 | - foreach($v2 as $key => $val) |
|
| 173 | + foreach ($v2 as $key => $val) |
|
| 174 | 174 | { |
| 175 | 175 | $expected = $out[$i]; |
| 176 | 176 | $this->assertequals($expected['key'], $key); |
@@ -184,7 +184,7 @@ discard block |
||
| 184 | 184 | { |
| 185 | 185 | // nb: make sure that the serialized xml corresponding to this is > 10MB in size |
| 186 | 186 | $data = array(); |
| 187 | - for ($i = 0; $i < 500000; $i++ ) { |
|
| 187 | + for ($i = 0; $i<500000; $i++) { |
|
| 188 | 188 | $data[] = 'hello world'; |
| 189 | 189 | } |
| 190 | 190 | |
@@ -1,6 +1,6 @@ discard block |
||
| 1 | 1 | <?php |
| 2 | 2 | |
| 3 | -include_once __DIR__ . '/LoggerAwareTestCase.php'; |
|
| 3 | +include_once __DIR__.'/LoggerAwareTestCase.php'; |
|
| 4 | 4 | |
| 5 | 5 | /** |
| 6 | 6 | * Tests involving xml parsing. |
@@ -101,7 +101,7 @@ discard block |
||
| 101 | 101 | |
| 102 | 102 | public function testI8() |
| 103 | 103 | { |
| 104 | - if (PHP_INT_SIZE == 4 ) { |
|
| 104 | + if (PHP_INT_SIZE == 4) { |
|
| 105 | 105 | $this->markTestSkipped('Can not test i8 as php is compiled in 32 bit mode'); |
| 106 | 106 | return; |
| 107 | 107 | } |
@@ -176,7 +176,7 @@ discard block |
||
| 176 | 176 | |
| 177 | 177 | public function testUnicodeInMemberName() |
| 178 | 178 | { |
| 179 | - $str = "G" . chr(252) . "nter, El" . chr(232) . "ne"; |
|
| 179 | + $str = "G".chr(252)."nter, El".chr(232)."ne"; |
|
| 180 | 180 | $v = array($str => new xmlrpcval(1)); |
| 181 | 181 | $r = new xmlrpcresp(new xmlrpcval($v, 'struct')); |
| 182 | 182 | $r = $r->serialize(); |
@@ -192,7 +192,7 @@ discard block |
||
| 192 | 192 | $response = @utf8_encode( |
| 193 | 193 | '<?xml version="1.0"?> |
| 194 | 194 | <!-- covers what happens when lib receives UTF8 chars in response text and comments --> |
| 195 | -<!-- ' . chr(224) . chr(252) . chr(232) . 'àüè --> |
|
| 195 | +<!-- ' . chr(224).chr(252).chr(232).'àüè --> |
|
| 196 | 196 | <methodResponse> |
| 197 | 197 | <fault> |
| 198 | 198 | <value> |
@@ -203,7 +203,7 @@ discard block |
||
| 203 | 203 | </member> |
| 204 | 204 | <member> |
| 205 | 205 | <name>faultString</name> |
| 206 | -<value><string>' . chr(224) . chr(252) . chr(232) . 'àüè</string></value> |
|
| 206 | +<value><string>' . chr(224).chr(252).chr(232).'àüè</string></value> |
|
| 207 | 207 | </member> |
| 208 | 208 | </struct> |
| 209 | 209 | </value> |
@@ -212,7 +212,7 @@ discard block |
||
| 212 | 212 | $m = $this->newRequest('dummy'); |
| 213 | 213 | $r = $m->parseResponse($response); |
| 214 | 214 | $v = $r->faultString(); |
| 215 | - $this->assertEquals(chr(224) . chr(252) . chr(232) . chr(224) . chr(252) . chr(232), $v); |
|
| 215 | + $this->assertEquals(chr(224).chr(252).chr(232).chr(224).chr(252).chr(232), $v); |
|
| 216 | 216 | } |
| 217 | 217 | |
| 218 | 218 | public function testBrokenRequests() |
@@ -419,8 +419,8 @@ discard block |
||
| 419 | 419 | $i = \PhpXmlRpc\PhpXmlRpc::$xmlrpc_reject_invalid_values; |
| 420 | 420 | \PhpXmlRpc\PhpXmlRpc::$xmlrpc_reject_invalid_values = true; |
| 421 | 421 | |
| 422 | - foreach($values as $value) { |
|
| 423 | - $f = '<?xml version="1.0"?><methodResponse><params><param><value>' . $value . '</value></param></params></methodResponse> '; |
|
| 422 | + foreach ($values as $value) { |
|
| 423 | + $f = '<?xml version="1.0"?><methodResponse><params><param><value>'.$value.'</value></param></params></methodResponse> '; |
|
| 424 | 424 | $r = $s->parseResponse($f); |
| 425 | 425 | $v = $r->faultCode(); |
| 426 | 426 | $this->assertEquals(2, $v, "Testing $value"); |
@@ -524,11 +524,11 @@ discard block |
||
| 524 | 524 | |
| 525 | 525 | public function testUTF8Response() |
| 526 | 526 | { |
| 527 | - $string = chr(224) . chr(252) . chr(232); |
|
| 527 | + $string = chr(224).chr(252).chr(232); |
|
| 528 | 528 | |
| 529 | 529 | $s = $this->newRequest('dummy'); |
| 530 | - $f = "HTTP/1.1 200 OK\r\nContent-type: text/xml; charset=UTF-8\r\n\r\n" . '<?xml version="1.0"?><methodResponse><params><param><value><struct><member><name>userid</name><value>311127</value></member> |
|
| 531 | -<member><name>dateCreated</name><value><dateTime.iso8601>20011126T09:17:52</dateTime.iso8601></value></member><member><name>content</name><value>' . @utf8_encode($string) . '</value></member><member><name>postid</name><value>7414222</value></member></struct></value></param></params></methodResponse> |
|
| 530 | + $f = "HTTP/1.1 200 OK\r\nContent-type: text/xml; charset=UTF-8\r\n\r\n".'<?xml version="1.0"?><methodResponse><params><param><value><struct><member><name>userid</name><value>311127</value></member> |
|
| 531 | +<member><name>dateCreated</name><value><dateTime.iso8601>20011126T09:17:52</dateTime.iso8601></value></member><member><name>content</name><value>' . @utf8_encode($string).'</value></member><member><name>postid</name><value>7414222</value></member></struct></value></param></params></methodResponse> |
|
| 532 | 532 | '; |
| 533 | 533 | $r = $s->parseResponse($f, false, 'phpvals'); |
| 534 | 534 | $v = $r->value(); |
@@ -536,7 +536,7 @@ discard block |
||
| 536 | 536 | $this->assertEquals($string, $v); |
| 537 | 537 | |
| 538 | 538 | $f = '<?xml version="1.0" encoding="UTF-8"?><methodResponse><params><param><value><struct><member><name>userid</name><value>311127</value></member> |
| 539 | -<member><name>dateCreated</name><value><dateTime.iso8601>20011126T09:17:52</dateTime.iso8601></value></member><member><name>content</name><value>' . @utf8_encode($string) . '</value></member><member><name>postid</name><value>7414222</value></member></struct></value></param></params></methodResponse> |
|
| 539 | +<member><name>dateCreated</name><value><dateTime.iso8601>20011126T09:17:52</dateTime.iso8601></value></member><member><name>content</name><value>' . @utf8_encode($string).'</value></member><member><name>postid</name><value>7414222</value></member></struct></value></param></params></methodResponse> |
|
| 540 | 540 | '; |
| 541 | 541 | $r = $s->parseResponse($f, false, 'phpvals'); |
| 542 | 542 | $v = $r->value(); |
@@ -552,11 +552,11 @@ discard block |
||
| 552 | 552 | |
| 553 | 553 | public function testLatin1Response() |
| 554 | 554 | { |
| 555 | - $string = chr(224) . chr(252) . chr(232); |
|
| 555 | + $string = chr(224).chr(252).chr(232); |
|
| 556 | 556 | |
| 557 | 557 | $s = $this->newRequest('dummy'); |
| 558 | - $f = "HTTP/1.1 200 OK\r\nContent-type: text/xml; charset=ISO-8859-1\r\n\r\n" . '<?xml version="1.0"?><methodResponse><params><param><value><struct><member><name>userid</name><value>311127</value></member> |
|
| 559 | -<member><name>dateCreated</name><value><dateTime.iso8601>20011126T09:17:52</dateTime.iso8601></value></member><member><name>content</name><value>' . $string . '</value></member><member><name>postid</name><value>7414222</value></member></struct></value></param></params></methodResponse> |
|
| 558 | + $f = "HTTP/1.1 200 OK\r\nContent-type: text/xml; charset=ISO-8859-1\r\n\r\n".'<?xml version="1.0"?><methodResponse><params><param><value><struct><member><name>userid</name><value>311127</value></member> |
|
| 559 | +<member><name>dateCreated</name><value><dateTime.iso8601>20011126T09:17:52</dateTime.iso8601></value></member><member><name>content</name><value>' . $string.'</value></member><member><name>postid</name><value>7414222</value></member></struct></value></param></params></methodResponse> |
|
| 560 | 560 | '; |
| 561 | 561 | $r = $s->parseResponse($f, false, 'phpvals'); |
| 562 | 562 | $v = $r->value(); |
@@ -564,7 +564,7 @@ discard block |
||
| 564 | 564 | $this->assertEquals($string, $v); |
| 565 | 565 | |
| 566 | 566 | $f = '<?xml version="1.0" encoding="ISO-8859-1"?><methodResponse><params><param><value><struct><member><name>userid</name><value>311127</value></member> |
| 567 | -<member><name>dateCreated</name><value><dateTime.iso8601>20011126T09:17:52</dateTime.iso8601></value></member><member><name>content</name><value>' . $string . '</value></member><member><name>postid</name><value>7414222</value></member></struct></value></param></params></methodResponse> |
|
| 567 | +<member><name>dateCreated</name><value><dateTime.iso8601>20011126T09:17:52</dateTime.iso8601></value></member><member><name>content</name><value>' . $string.'</value></member><member><name>postid</name><value>7414222</value></member></struct></value></param></params></methodResponse> |
|
| 568 | 568 | '; |
| 569 | 569 | $r = $s->parseResponse($f, false, 'phpvals'); |
| 570 | 570 | $v = $r->value(); |
@@ -1,6 +1,6 @@ discard block |
||
| 1 | 1 | <?php |
| 2 | 2 | |
| 3 | -include_once __DIR__ . '/LoggerAwareTestCase.php'; |
|
| 3 | +include_once __DIR__.'/LoggerAwareTestCase.php'; |
|
| 4 | 4 | |
| 5 | 5 | use PHPUnit\Extensions\SeleniumCommon\RemoteCoverage; |
| 6 | 6 | use PHPUnit\Framework\TestResult; |
@@ -28,7 +28,7 @@ discard block |
||
| 28 | 28 | */ |
| 29 | 29 | public function _run($result = NULL) |
| 30 | 30 | { |
| 31 | - $this->testId = get_class($this) . '__' . $this->getName(); |
|
| 31 | + $this->testId = get_class($this).'__'.$this->getName(); |
|
| 32 | 32 | |
| 33 | 33 | if ($result === NULL) { |
| 34 | 34 | $result = $this->createResult(); |
@@ -59,7 +59,7 @@ discard block |
||
| 59 | 59 | parent::set_up(); |
| 60 | 60 | |
| 61 | 61 | // assumes HTTPURI to be in the form /tests/index.php?etc... |
| 62 | - $this->baseUrl = 'http://' . $this->args['HTTPSERVER'] . preg_replace('|\?.+|', '', $this->args['HTTPURI']); |
|
| 63 | - $this->coverageScriptUrl = 'http://' . $this->args['HTTPSERVER'] . preg_replace('|/tests/index\.php(\?.*)?|', '/tests/phpunit_coverage.php', $this->args['HTTPURI']); |
|
| 62 | + $this->baseUrl = 'http://'.$this->args['HTTPSERVER'].preg_replace('|\?.+|', '', $this->args['HTTPURI']); |
|
| 63 | + $this->coverageScriptUrl = 'http://'.$this->args['HTTPSERVER'].preg_replace('|/tests/index\.php(\?.*)?|', '/tests/phpunit_coverage.php', $this->args['HTTPURI']); |
|
| 64 | 64 | } |
| 65 | 65 | } |
@@ -260,7 +260,7 @@ discard block |
||
| 260 | 260 | public function getOptions() |
| 261 | 261 | { |
| 262 | 262 | $values = array(); |
| 263 | - foreach($this->options as $opt) { |
|
| 263 | + foreach ($this->options as $opt) { |
|
| 264 | 264 | $values[$opt] = $this->getOption($opt); |
| 265 | 265 | } |
| 266 | 266 | return $values; |
@@ -273,7 +273,7 @@ discard block |
||
| 273 | 273 | */ |
| 274 | 274 | public function setOptions($options) |
| 275 | 275 | { |
| 276 | - foreach($options as $name => $value) { |
|
| 276 | + foreach ($options as $name => $value) { |
|
| 277 | 277 | $this->setOption($name, $value); |
| 278 | 278 | } |
| 279 | 279 | |
@@ -312,7 +312,7 @@ discard block |
||
| 312 | 312 | */ |
| 313 | 313 | public static function xmlrpc_debugmsg($msg) |
| 314 | 314 | { |
| 315 | - static::$_xmlrpc_debuginfo .= $msg . "\n"; |
|
| 315 | + static::$_xmlrpc_debuginfo .= $msg."\n"; |
|
| 316 | 316 | } |
| 317 | 317 | |
| 318 | 318 | /** |
@@ -324,7 +324,7 @@ discard block |
||
| 324 | 324 | */ |
| 325 | 325 | public static function error_occurred($msg) |
| 326 | 326 | { |
| 327 | - static::$_xmlrpcs_occurred_errors .= $msg . "\n"; |
|
| 327 | + static::$_xmlrpcs_occurred_errors .= $msg."\n"; |
|
| 328 | 328 | } |
| 329 | 329 | |
| 330 | 330 | /** |
@@ -345,10 +345,10 @@ discard block |
||
| 345 | 345 | // user debug info should be encoded by the end user using the INTERNAL_ENCODING |
| 346 | 346 | $out = ''; |
| 347 | 347 | if ($this->debug_info != '') { |
| 348 | - $out .= "<!-- SERVER DEBUG INFO (BASE64 ENCODED):\n" . base64_encode($this->debug_info) . "\n-->\n"; |
|
| 348 | + $out .= "<!-- SERVER DEBUG INFO (BASE64 ENCODED):\n".base64_encode($this->debug_info)."\n-->\n"; |
|
| 349 | 349 | } |
| 350 | 350 | if (static::$_xmlrpc_debuginfo != '') { |
| 351 | - $out .= "<!-- DEBUG INFO:\n" . $this->getCharsetEncoder()->encodeEntities(str_replace('--', '_-', static::$_xmlrpc_debuginfo), PhpXmlRpc::$xmlrpc_internalencoding, $charsetEncoding) . "\n-->\n"; |
|
| 351 | + $out .= "<!-- DEBUG INFO:\n".$this->getCharsetEncoder()->encodeEntities(str_replace('--', '_-', static::$_xmlrpc_debuginfo), PhpXmlRpc::$xmlrpc_internalencoding, $charsetEncoding)."\n-->\n"; |
|
| 352 | 352 | // NB: a better solution MIGHT be to use CDATA, but we need to insert it |
| 353 | 353 | // into return payload AFTER the beginning tag |
| 354 | 354 | //$out .= "<![CDATA[ DEBUG INFO:\n\n" . str_replace(']]>', ']_]_>', static::$_xmlrpc_debuginfo) . "\n]]>\n"; |
@@ -377,8 +377,8 @@ discard block |
||
| 377 | 377 | $this->debug_info = ''; |
| 378 | 378 | |
| 379 | 379 | // Save what we received, before parsing it |
| 380 | - if ($this->debug > 1) { |
|
| 381 | - $this->debugmsg("+++GOT+++\n" . $data . "\n+++END+++"); |
|
| 380 | + if ($this->debug>1) { |
|
| 381 | + $this->debugmsg("+++GOT+++\n".$data."\n+++END+++"); |
|
| 382 | 382 | } |
| 383 | 383 | |
| 384 | 384 | $resp = $this->parseRequestHeaders($data, $reqCharset, $respCharset, $respEncoding); |
@@ -395,14 +395,14 @@ discard block |
||
| 395 | 395 | $resp->raw_data = $rawData; |
| 396 | 396 | } |
| 397 | 397 | |
| 398 | - if ($this->debug > 2 && static::$_xmlrpcs_occurred_errors != '') { |
|
| 399 | - $this->debugmsg("+++PROCESSING ERRORS AND WARNINGS+++\n" . |
|
| 400 | - static::$_xmlrpcs_occurred_errors . "+++END+++"); |
|
| 398 | + if ($this->debug>2 && static::$_xmlrpcs_occurred_errors != '') { |
|
| 399 | + $this->debugmsg("+++PROCESSING ERRORS AND WARNINGS+++\n". |
|
| 400 | + static::$_xmlrpcs_occurred_errors."+++END+++"); |
|
| 401 | 401 | } |
| 402 | 402 | |
| 403 | 403 | $payload = $this->xml_header($respCharset); |
| 404 | - if ($this->debug > 0) { |
|
| 405 | - $payload = $payload . $this->serializeDebug($respCharset); |
|
| 404 | + if ($this->debug>0) { |
|
| 405 | + $payload = $payload.$this->serializeDebug($respCharset); |
|
| 406 | 406 | } |
| 407 | 407 | |
| 408 | 408 | // Do not create response serialization if it has already happened. Helps to build json magic |
@@ -410,7 +410,7 @@ discard block |
||
| 410 | 410 | if (empty($resp->payload)) { |
| 411 | 411 | $resp->serialize($respCharset); |
| 412 | 412 | } |
| 413 | - $payload = $payload . $resp->payload; |
|
| 413 | + $payload = $payload.$resp->payload; |
|
| 414 | 414 | |
| 415 | 415 | if ($returnPayload) { |
| 416 | 416 | return $payload; |
@@ -419,7 +419,7 @@ discard block |
||
| 419 | 419 | // if we get a warning/error that has output some text before here, then we cannot |
| 420 | 420 | // add a new header. We cannot say we are sending xml, either... |
| 421 | 421 | if (!headers_sent()) { |
| 422 | - header('Content-Type: ' . $resp->content_type); |
|
| 422 | + header('Content-Type: '.$resp->content_type); |
|
| 423 | 423 | // we do not know if client actually told us an accepted charset, but if it did we have to tell it what we did |
| 424 | 424 | header("Vary: Accept-Charset"); |
| 425 | 425 | |
@@ -442,10 +442,10 @@ discard block |
||
| 442 | 442 | // Note that Apache/mod_php will add (and even alter!) the Content-Length header on its own, but only for |
| 443 | 443 | // responses up to 8000 bytes |
| 444 | 444 | if ($phpNoSelfCompress) { |
| 445 | - header('Content-Length: ' . (int)strlen($payload)); |
|
| 445 | + header('Content-Length: '.(int) strlen($payload)); |
|
| 446 | 446 | } |
| 447 | 447 | } else { |
| 448 | - $this->getLogger()->error('XML-RPC: ' . __METHOD__ . ': http headers already sent before response is fully generated. Check for php warning or error messages'); |
|
| 448 | + $this->getLogger()->error('XML-RPC: '.__METHOD__.': http headers already sent before response is fully generated. Check for php warning or error messages'); |
|
| 449 | 449 | } |
| 450 | 450 | |
| 451 | 451 | print $payload; |
@@ -508,9 +508,9 @@ discard block |
||
| 508 | 508 | $numParams = count($in); |
| 509 | 509 | } |
| 510 | 510 | foreach ($sigs as $curSig) { |
| 511 | - if (count($curSig) == $numParams + 1) { |
|
| 511 | + if (count($curSig) == $numParams+1) { |
|
| 512 | 512 | $itsOK = 1; |
| 513 | - for ($n = 0; $n < $numParams; $n++) { |
|
| 513 | + for ($n = 0; $n<$numParams; $n++) { |
|
| 514 | 514 | if (is_object($in)) { |
| 515 | 515 | $p = $in->getParam($n); |
| 516 | 516 | if ($p->kindOf() == 'scalar') { |
@@ -523,10 +523,10 @@ discard block |
||
| 523 | 523 | } |
| 524 | 524 | |
| 525 | 525 | // param index is $n+1, as first member of sig is return type |
| 526 | - if ($pt != $curSig[$n + 1] && $curSig[$n + 1] != Value::$xmlrpcValue) { |
|
| 526 | + if ($pt != $curSig[$n+1] && $curSig[$n+1] != Value::$xmlrpcValue) { |
|
| 527 | 527 | $itsOK = 0; |
| 528 | - $pno = $n + 1; |
|
| 529 | - $wanted = $curSig[$n + 1]; |
|
| 528 | + $pno = $n+1; |
|
| 529 | + $wanted = $curSig[$n+1]; |
|
| 530 | 530 | $got = $pt; |
| 531 | 531 | break; |
| 532 | 532 | } |
@@ -553,10 +553,10 @@ discard block |
||
| 553 | 553 | // check if $_SERVER is populated: it might have been disabled via ini file |
| 554 | 554 | // (this is true even when in CLI mode) |
| 555 | 555 | if (count($_SERVER) == 0) { |
| 556 | - $this->getLogger()->error('XML-RPC: ' . __METHOD__ . ': cannot parse request headers as $_SERVER is not populated'); |
|
| 556 | + $this->getLogger()->error('XML-RPC: '.__METHOD__.': cannot parse request headers as $_SERVER is not populated'); |
|
| 557 | 557 | } |
| 558 | 558 | |
| 559 | - if ($this->debug > 1) { |
|
| 559 | + if ($this->debug>1) { |
|
| 560 | 560 | if (function_exists('getallheaders')) { |
| 561 | 561 | $this->debugmsg(''); // empty line |
| 562 | 562 | foreach (getallheaders() as $name => $val) { |
@@ -581,13 +581,13 @@ discard block |
||
| 581 | 581 | if (function_exists('gzinflate') && in_array($contentEncoding, $this->accepted_compression)) { |
| 582 | 582 | if ($contentEncoding == 'deflate' && $degzdata = @gzuncompress($data)) { |
| 583 | 583 | $data = $degzdata; |
| 584 | - if ($this->debug > 1) { |
|
| 585 | - $this->debugmsg("\n+++INFLATED REQUEST+++[" . strlen($data) . " chars]+++\n" . $data . "\n+++END+++"); |
|
| 584 | + if ($this->debug>1) { |
|
| 585 | + $this->debugmsg("\n+++INFLATED REQUEST+++[".strlen($data)." chars]+++\n".$data."\n+++END+++"); |
|
| 586 | 586 | } |
| 587 | 587 | } elseif ($contentEncoding == 'gzip' && $degzdata = @gzinflate(substr($data, 10))) { |
| 588 | 588 | $data = $degzdata; |
| 589 | - if ($this->debug > 1) { |
|
| 590 | - $this->debugmsg("+++INFLATED REQUEST+++[" . strlen($data) . " chars]+++\n" . $data . "\n+++END+++"); |
|
| 589 | + if ($this->debug>1) { |
|
| 590 | + $this->debugmsg("+++INFLATED REQUEST+++[".strlen($data)." chars]+++\n".$data."\n+++END+++"); |
|
| 591 | 591 | } |
| 592 | 592 | } else { |
| 593 | 593 | $r = new Response(0, PhpXmlRpc::$xmlrpcerr['server_decompress_fail'], |
@@ -674,7 +674,7 @@ discard block |
||
| 674 | 674 | if ($reqEncoding == 'ISO-8859-1') { |
| 675 | 675 | $data = utf8_encode($data); |
| 676 | 676 | } else { |
| 677 | - $this->getLogger()->error('XML-RPC: ' . __METHOD__ . ': unsupported charset encoding of received request: ' . $reqEncoding); |
|
| 677 | + $this->getLogger()->error('XML-RPC: '.__METHOD__.': unsupported charset encoding of received request: '.$reqEncoding); |
|
| 678 | 678 | } |
| 679 | 679 | } |
| 680 | 680 | } |
@@ -701,7 +701,7 @@ discard block |
||
| 701 | 701 | preg_match('/^XML error ([0-9]+)/', $xmlRpcParser->_xh['isf_reason'], $matches); |
| 702 | 702 | return new Response( |
| 703 | 703 | 0, |
| 704 | - PhpXmlRpc::$xmlrpcerrxml + (int)$matches[1], |
|
| 704 | + PhpXmlRpc::$xmlrpcerrxml+(int) $matches[1], |
|
| 705 | 705 | $xmlRpcParser->_xh['isf_reason']); |
| 706 | 706 | } elseif ($xmlRpcParser->_xh['isf']) { |
| 707 | 707 | /// @todo separate better the various cases, as we have done in Request::parseResponse: invalid xml-rpc vs. |
@@ -709,7 +709,7 @@ discard block |
||
| 709 | 709 | return new Response( |
| 710 | 710 | 0, |
| 711 | 711 | PhpXmlRpc::$xmlrpcerr['invalid_request'], |
| 712 | - PhpXmlRpc::$xmlrpcstr['invalid_request'] . ' ' . $xmlRpcParser->_xh['isf_reason']); |
|
| 712 | + PhpXmlRpc::$xmlrpcstr['invalid_request'].' '.$xmlRpcParser->_xh['isf_reason']); |
|
| 713 | 713 | } else { |
| 714 | 714 | // small layering violation in favor of speed and memory usage: we should allow the 'execute' method handle |
| 715 | 715 | // this, but in the most common scenario (xml-rpc values type server with some methods registered as phpvals) |
@@ -719,20 +719,20 @@ discard block |
||
| 719 | 719 | ($this->dmap[$xmlRpcParser->_xh['method']]['parameters_type'] != 'xmlrpcvals') |
| 720 | 720 | ) |
| 721 | 721 | ) { |
| 722 | - if ($this->debug > 1) { |
|
| 723 | - $this->debugmsg("\n+++PARSED+++\n" . var_export($xmlRpcParser->_xh['params'], true) . "\n+++END+++"); |
|
| 722 | + if ($this->debug>1) { |
|
| 723 | + $this->debugmsg("\n+++PARSED+++\n".var_export($xmlRpcParser->_xh['params'], true)."\n+++END+++"); |
|
| 724 | 724 | } |
| 725 | 725 | |
| 726 | 726 | return $this->execute($xmlRpcParser->_xh['method'], $xmlRpcParser->_xh['params'], $xmlRpcParser->_xh['pt']); |
| 727 | 727 | } else { |
| 728 | 728 | // build a Request object with data parsed from xml and add parameters in |
| 729 | 729 | $req = new Request($xmlRpcParser->_xh['method']); |
| 730 | - for ($i = 0; $i < count($xmlRpcParser->_xh['params']); $i++) { |
|
| 730 | + for ($i = 0; $i<count($xmlRpcParser->_xh['params']); $i++) { |
|
| 731 | 731 | $req->addParam($xmlRpcParser->_xh['params'][$i]); |
| 732 | 732 | } |
| 733 | 733 | |
| 734 | - if ($this->debug > 1) { |
|
| 735 | - $this->debugmsg("\n+++PARSED+++\n" . var_export($req, true) . "\n+++END+++"); |
|
| 734 | + if ($this->debug>1) { |
|
| 735 | + $this->debugmsg("\n+++PARSED+++\n".var_export($req, true)."\n+++END+++"); |
|
| 736 | 736 | } |
| 737 | 737 | |
| 738 | 738 | return $this->execute($req); |
@@ -784,7 +784,7 @@ discard block |
||
| 784 | 784 | return new Response( |
| 785 | 785 | 0, |
| 786 | 786 | PhpXmlRpc::$xmlrpcerr['incorrect_params'], |
| 787 | - PhpXmlRpc::$xmlrpcstr['incorrect_params'] . ": {$errStr}" |
|
| 787 | + PhpXmlRpc::$xmlrpcstr['incorrect_params'].": {$errStr}" |
|
| 788 | 788 | ); |
| 789 | 789 | } |
| 790 | 790 | } |
@@ -799,7 +799,7 @@ discard block |
||
| 799 | 799 | // build string representation of function 'name' |
| 800 | 800 | if (is_array($func)) { |
| 801 | 801 | if (is_object($func[0])) { |
| 802 | - $funcName = get_class($func[0]) . '->' . $func[1]; |
|
| 802 | + $funcName = get_class($func[0]).'->'.$func[1]; |
|
| 803 | 803 | } else { |
| 804 | 804 | $funcName = implode('::', $func); |
| 805 | 805 | } |
@@ -811,23 +811,23 @@ discard block |
||
| 811 | 811 | |
| 812 | 812 | // verify that function to be invoked is in fact callable |
| 813 | 813 | if (!is_callable($func)) { |
| 814 | - $this->getLogger()->error("XML-RPC: " . __METHOD__ . ": function '$funcName' registered as method handler is not callable"); |
|
| 814 | + $this->getLogger()->error("XML-RPC: ".__METHOD__.": function '$funcName' registered as method handler is not callable"); |
|
| 815 | 815 | return new Response( |
| 816 | 816 | 0, |
| 817 | 817 | PhpXmlRpc::$xmlrpcerr['server_error'], |
| 818 | - PhpXmlRpc::$xmlrpcstr['server_error'] . ": no function matches method" |
|
| 818 | + PhpXmlRpc::$xmlrpcstr['server_error'].": no function matches method" |
|
| 819 | 819 | ); |
| 820 | 820 | } |
| 821 | 821 | |
| 822 | 822 | if (isset($dmap[$methodName]['exception_handling'])) { |
| 823 | - $exception_handling = (int)$dmap[$methodName]['exception_handling']; |
|
| 823 | + $exception_handling = (int) $dmap[$methodName]['exception_handling']; |
|
| 824 | 824 | } else { |
| 825 | 825 | $exception_handling = $this->exception_handling; |
| 826 | 826 | } |
| 827 | 827 | |
| 828 | 828 | // If debug level is 3, we should catch all errors generated during processing of user function, and log them |
| 829 | 829 | // as part of response |
| 830 | - if ($this->debug > 2) { |
|
| 830 | + if ($this->debug>2) { |
|
| 831 | 831 | self::$_xmlrpcs_prev_ehandler = set_error_handler(array('\PhpXmlRpc\Server', '_xmlrpcs_errorHandler')); |
| 832 | 832 | } |
| 833 | 833 | |
@@ -841,14 +841,14 @@ discard block |
||
| 841 | 841 | $r = call_user_func($func, $req); |
| 842 | 842 | } |
| 843 | 843 | if (!is_a($r, 'PhpXmlRpc\Response')) { |
| 844 | - $this->getLogger()->error("XML-RPC: " . __METHOD__ . ": function '$funcName' registered as method handler does not return an xmlrpc response object but a " . gettype($r)); |
|
| 844 | + $this->getLogger()->error("XML-RPC: ".__METHOD__.": function '$funcName' registered as method handler does not return an xmlrpc response object but a ".gettype($r)); |
|
| 845 | 845 | if (is_a($r, 'PhpXmlRpc\Value')) { |
| 846 | 846 | $r = new Response($r); |
| 847 | 847 | } else { |
| 848 | 848 | $r = new Response( |
| 849 | 849 | 0, |
| 850 | 850 | PhpXmlRpc::$xmlrpcerr['server_error'], |
| 851 | - PhpXmlRpc::$xmlrpcstr['server_error'] . ": function does not return xmlrpc response object" |
|
| 851 | + PhpXmlRpc::$xmlrpcstr['server_error'].": function does not return xmlrpc response object" |
|
| 852 | 852 | ); |
| 853 | 853 | } |
| 854 | 854 | } |
@@ -863,7 +863,7 @@ discard block |
||
| 863 | 863 | $r = call_user_func_array($func, array($methodName, $params, $this->user_data)); |
| 864 | 864 | // mimic EPI behaviour: if we get an array that looks like an error, make it an error response |
| 865 | 865 | if (is_array($r) && array_key_exists('faultCode', $r) && array_key_exists('faultString', $r)) { |
| 866 | - $r = new Response(0, (integer)$r['faultCode'], (string)$r['faultString']); |
|
| 866 | + $r = new Response(0, (integer) $r['faultCode'], (string) $r['faultString']); |
|
| 867 | 867 | } else { |
| 868 | 868 | // functions using EPI api should NOT return resp objects, so make sure we encode the |
| 869 | 869 | // return type correctly |
@@ -888,7 +888,7 @@ discard block |
||
| 888 | 888 | // proper error-response |
| 889 | 889 | switch ($exception_handling) { |
| 890 | 890 | case 2: |
| 891 | - if ($this->debug > 2) { |
|
| 891 | + if ($this->debug>2) { |
|
| 892 | 892 | if (self::$_xmlrpcs_prev_ehandler) { |
| 893 | 893 | set_error_handler(self::$_xmlrpcs_prev_ehandler); |
| 894 | 894 | } else { |
@@ -911,7 +911,7 @@ discard block |
||
| 911 | 911 | // proper error-response |
| 912 | 912 | switch ($exception_handling) { |
| 913 | 913 | case 2: |
| 914 | - if ($this->debug > 2) { |
|
| 914 | + if ($this->debug>2) { |
|
| 915 | 915 | if (self::$_xmlrpcs_prev_ehandler) { |
| 916 | 916 | set_error_handler(self::$_xmlrpcs_prev_ehandler); |
| 917 | 917 | } else { |
@@ -931,7 +931,7 @@ discard block |
||
| 931 | 931 | } |
| 932 | 932 | } |
| 933 | 933 | |
| 934 | - if ($this->debug > 2) { |
|
| 934 | + if ($this->debug>2) { |
|
| 935 | 935 | // note: restore the error handler we found before calling the user func, even if it has been changed |
| 936 | 936 | // inside the func itself |
| 937 | 937 | if (self::$_xmlrpcs_prev_ehandler) { |
@@ -997,7 +997,7 @@ discard block |
||
| 997 | 997 | */ |
| 998 | 998 | protected function debugmsg($string) |
| 999 | 999 | { |
| 1000 | - $this->debug_info .= $string . "\n"; |
|
| 1000 | + $this->debug_info .= $string."\n"; |
|
| 1001 | 1001 | } |
| 1002 | 1002 | |
| 1003 | 1003 | /** |
@@ -1007,9 +1007,9 @@ discard block |
||
| 1007 | 1007 | protected function xml_header($charsetEncoding = '') |
| 1008 | 1008 | { |
| 1009 | 1009 | if ($charsetEncoding != '') { |
| 1010 | - return "<?xml version=\"1.0\" encoding=\"$charsetEncoding\"?" . ">\n"; |
|
| 1010 | + return "<?xml version=\"1.0\" encoding=\"$charsetEncoding\"?".">\n"; |
|
| 1011 | 1011 | } else { |
| 1012 | - return "<?xml version=\"1.0\"?" . ">\n"; |
|
| 1012 | + return "<?xml version=\"1.0\"?".">\n"; |
|
| 1013 | 1013 | } |
| 1014 | 1014 | } |
| 1015 | 1015 | |
@@ -1302,7 +1302,7 @@ discard block |
||
| 1302 | 1302 | $i++; // for error message, we count params from 1 |
| 1303 | 1303 | return static::_xmlrpcs_multicall_error(new Response(0, |
| 1304 | 1304 | PhpXmlRpc::$xmlrpcerr['incorrect_params'], |
| 1305 | - PhpXmlRpc::$xmlrpcstr['incorrect_params'] . ": probable xml error in param " . $i)); |
|
| 1305 | + PhpXmlRpc::$xmlrpcstr['incorrect_params'].": probable xml error in param ".$i)); |
|
| 1306 | 1306 | } |
| 1307 | 1307 | } |
| 1308 | 1308 | |
@@ -1383,7 +1383,7 @@ discard block |
||
| 1383 | 1383 | } |
| 1384 | 1384 | } else { |
| 1385 | 1385 | $numCalls = count($req); |
| 1386 | - for ($i = 0; $i < $numCalls; $i++) { |
|
| 1386 | + for ($i = 0; $i<$numCalls; $i++) { |
|
| 1387 | 1387 | $result[$i] = static::_xmlrpcs_multicall_do_call_phpvals($server, $req[$i]); |
| 1388 | 1388 | } |
| 1389 | 1389 | } |