@@ -8,7 +8,7 @@ discard block |
||
8 | 8 | * `$functions_parameters_type` and `$exception_handling` |
9 | 9 | */ |
10 | 10 | |
11 | -require_once __DIR__ . "/_prepend.php"; |
|
11 | +require_once __DIR__."/_prepend.php"; |
|
12 | 12 | |
13 | 13 | require_once __DIR__.'/methodProviders/CommentManager.php'; |
14 | 14 | |
@@ -19,12 +19,12 @@ discard block |
||
19 | 19 | |
20 | 20 | $addComment_sig = array(array(Value::$xmlrpcInt, Value::$xmlrpcString, Value::$xmlrpcString, Value::$xmlrpcString)); |
21 | 21 | |
22 | -$addComment_doc = 'Adds a comment to an item. The first parameter is the item ID, the second the name of the commenter, ' . |
|
22 | +$addComment_doc = 'Adds a comment to an item. The first parameter is the item ID, the second the name of the commenter, '. |
|
23 | 23 | 'and the third is the comment itself. Returns the number of comments against that ID.'; |
24 | 24 | |
25 | 25 | $getComments_sig = array(array(Value::$xmlrpcArray, Value::$xmlrpcString)); |
26 | 26 | |
27 | -$getComments_doc = 'Returns an array of comments for a given ID, which is the sole argument. Each array item is a struct ' . |
|
27 | +$getComments_doc = 'Returns an array of comments for a given ID, which is the sole argument. Each array item is a struct '. |
|
28 | 28 | 'containing name and comment text.'; |
29 | 29 | |
30 | 30 | $srv = new Server(); |
@@ -1,5 +1,5 @@ |
||
1 | 1 | <?php |
2 | -require_once __DIR__ . "/_prepend.php"; |
|
2 | +require_once __DIR__."/_prepend.php"; |
|
3 | 3 | |
4 | 4 | /** |
5 | 5 | * Demoing the charset conversion of the library: create a client class which uses data in the CP-1252 character set, |
@@ -1,11 +1,11 @@ discard block |
||
1 | 1 | <?php |
2 | 2 | |
3 | -include_once __DIR__ . '/../lib/xmlrpc.inc'; |
|
4 | -include_once __DIR__ . '/../lib/xmlrpcs.inc'; |
|
3 | +include_once __DIR__.'/../lib/xmlrpc.inc'; |
|
4 | +include_once __DIR__.'/../lib/xmlrpcs.inc'; |
|
5 | 5 | |
6 | -include_once __DIR__ . '/parse_args.php'; |
|
6 | +include_once __DIR__.'/parse_args.php'; |
|
7 | 7 | |
8 | -include_once __DIR__ . '/PolyfillTestCase.php'; |
|
8 | +include_once __DIR__.'/PolyfillTestCase.php'; |
|
9 | 9 | |
10 | 10 | use PHPUnit\Runner\BaseTestRunner; |
11 | 11 | |
@@ -103,7 +103,7 @@ discard block |
||
103 | 103 | /// @todo it seems that old php versions can not automatically transform latin to utf8 upon xml parsing. |
104 | 104 | /// We should fix that, then re-enable this test |
105 | 105 | if (version_compare(PHP_VERSION, '5.6.0', '>=')) { |
106 | - $i = $e->decodeXml('<?xml version="1.0" encoding="ISO-8859-15" ?><value><string>' . $string . '</string></value>'); |
|
106 | + $i = $e->decodeXml('<?xml version="1.0" encoding="ISO-8859-15" ?><value><string>'.$string.'</string></value>'); |
|
107 | 107 | $this->assertEquals($string, $i->scalarVal()); |
108 | 108 | } |
109 | 109 |
@@ -129,7 +129,7 @@ discard block |
||
129 | 129 | $this->me['struct'] = $val; |
130 | 130 | break; |
131 | 131 | default: |
132 | - $this->getLogger()->errorLog("XML-RPC: " . __METHOD__ . ": not a known type ($type)"); |
|
132 | + $this->getLogger()->errorLog("XML-RPC: ".__METHOD__.": not a known type ($type)"); |
|
133 | 133 | } |
134 | 134 | } |
135 | 135 | } |
@@ -153,7 +153,7 @@ discard block |
||
153 | 153 | } |
154 | 154 | |
155 | 155 | if ($typeOf !== 1) { |
156 | - $this->getLogger()->errorLog("XML-RPC: " . __METHOD__ . ": not a scalar type ($type)"); |
|
156 | + $this->getLogger()->errorLog("XML-RPC: ".__METHOD__.": not a scalar type ($type)"); |
|
157 | 157 | return 0; |
158 | 158 | } |
159 | 159 | |
@@ -170,10 +170,10 @@ discard block |
||
170 | 170 | |
171 | 171 | switch ($this->mytype) { |
172 | 172 | case 1: |
173 | - $this->getLogger()->errorLog('XML-RPC: ' . __METHOD__ . ': scalar xmlrpc value can have only one value'); |
|
173 | + $this->getLogger()->errorLog('XML-RPC: '.__METHOD__.': scalar xmlrpc value can have only one value'); |
|
174 | 174 | return 0; |
175 | 175 | case 3: |
176 | - $this->getLogger()->errorLog('XML-RPC: ' . __METHOD__ . ': cannot add anonymous scalar to struct xmlrpc value'); |
|
176 | + $this->getLogger()->errorLog('XML-RPC: '.__METHOD__.': cannot add anonymous scalar to struct xmlrpc value'); |
|
177 | 177 | return 0; |
178 | 178 | case 2: |
179 | 179 | // we're adding a scalar value to an array here |
@@ -214,7 +214,7 @@ discard block |
||
214 | 214 | |
215 | 215 | return 1; |
216 | 216 | } else { |
217 | - $this->getLogger()->errorLog('XML-RPC: ' . __METHOD__ . ': already initialized as a [' . $this->kindOf() . ']'); |
|
217 | + $this->getLogger()->errorLog('XML-RPC: '.__METHOD__.': already initialized as a ['.$this->kindOf().']'); |
|
218 | 218 | return 0; |
219 | 219 | } |
220 | 220 | } |
@@ -244,7 +244,7 @@ discard block |
||
244 | 244 | |
245 | 245 | return 1; |
246 | 246 | } else { |
247 | - $this->getLogger()->errorLog('XML-RPC: ' . __METHOD__ . ': already initialized as a [' . $this->kindOf() . ']'); |
|
247 | + $this->getLogger()->errorLog('XML-RPC: '.__METHOD__.': already initialized as a ['.$this->kindOf().']'); |
|
248 | 248 | return 0; |
249 | 249 | } |
250 | 250 | } |
@@ -286,19 +286,19 @@ discard block |
||
286 | 286 | case 1: |
287 | 287 | switch ($typ) { |
288 | 288 | case static::$xmlrpcBase64: |
289 | - $rs .= "<{$typ}>" . base64_encode($val) . "</{$typ}>"; |
|
289 | + $rs .= "<{$typ}>".base64_encode($val)."</{$typ}>"; |
|
290 | 290 | break; |
291 | 291 | case static::$xmlrpcBoolean: |
292 | - $rs .= "<{$typ}>" . ($val ? '1' : '0') . "</{$typ}>"; |
|
292 | + $rs .= "<{$typ}>".($val ? '1' : '0')."</{$typ}>"; |
|
293 | 293 | break; |
294 | 294 | case static::$xmlrpcString: |
295 | 295 | // Do NOT use htmlentities, since it will produce named html entities, which are invalid xml |
296 | - $rs .= "<{$typ}>" . $this->getCharsetEncoder()->encodeEntities($val, PhpXmlRpc::$xmlrpc_internalencoding, $charsetEncoding) . "</{$typ}>"; |
|
296 | + $rs .= "<{$typ}>".$this->getCharsetEncoder()->encodeEntities($val, PhpXmlRpc::$xmlrpc_internalencoding, $charsetEncoding)."</{$typ}>"; |
|
297 | 297 | break; |
298 | 298 | case static::$xmlrpcInt: |
299 | 299 | case static::$xmlrpcI4: |
300 | 300 | case static::$xmlrpcI8: |
301 | - $rs .= "<{$typ}>" . (int)$val . "</{$typ}>"; |
|
301 | + $rs .= "<{$typ}>".(int) $val."</{$typ}>"; |
|
302 | 302 | break; |
303 | 303 | case static::$xmlrpcDouble: |
304 | 304 | // avoid using standard conversion of float to string because it is locale-dependent, |
@@ -306,16 +306,16 @@ discard block |
||
306 | 306 | // sprintf('%F') could be most likely ok, but it fails e.g. on 2e-14. |
307 | 307 | // The code below tries its best at keeping max precision while avoiding exp notation, |
308 | 308 | // but there is of course no limit in the number of decimal places to be used... |
309 | - $rs .= "<{$typ}>" . preg_replace('/\\.?0+$/', '', number_format((double)$val, PhpXmlRpc::$xmlpc_double_precision, '.', '')) . "</{$typ}>"; |
|
309 | + $rs .= "<{$typ}>".preg_replace('/\\.?0+$/', '', number_format((double) $val, PhpXmlRpc::$xmlpc_double_precision, '.', ''))."</{$typ}>"; |
|
310 | 310 | break; |
311 | 311 | case static::$xmlrpcDateTime: |
312 | 312 | if (is_string($val)) { |
313 | 313 | $rs .= "<{$typ}>{$val}</{$typ}>"; |
314 | 314 | // DateTimeInterface is not present in php 5.4... |
315 | 315 | } elseif (is_a($val, 'DateTimeInterface') || is_a($val, 'DateTime')) { |
316 | - $rs .= "<{$typ}>" . $val->format('Ymd\TH:i:s') . "</{$typ}>"; |
|
316 | + $rs .= "<{$typ}>".$val->format('Ymd\TH:i:s')."</{$typ}>"; |
|
317 | 317 | } elseif (is_int($val)) { |
318 | - $rs .= "<{$typ}>" . date('Ymd\TH:i:s', $val) . "</{$typ}>"; |
|
318 | + $rs .= "<{$typ}>".date('Ymd\TH:i:s', $val)."</{$typ}>"; |
|
319 | 319 | } else { |
320 | 320 | // not really a good idea here: but what should we output anyway? left for backward compat... |
321 | 321 | $rs .= "<{$typ}>{$val}</{$typ}>"; |
@@ -337,14 +337,14 @@ discard block |
||
337 | 337 | case 3: |
338 | 338 | // struct |
339 | 339 | if ($this->_php_class) { |
340 | - $rs .= '<struct php_class="' . $this->_php_class . "\">\n"; |
|
340 | + $rs .= '<struct php_class="'.$this->_php_class."\">\n"; |
|
341 | 341 | } else { |
342 | 342 | $rs .= "<struct>\n"; |
343 | 343 | } |
344 | 344 | $charsetEncoder = $this->getCharsetEncoder(); |
345 | 345 | /** @var Value $val2 */ |
346 | 346 | foreach ($val as $key2 => $val2) { |
347 | - $rs .= '<member><name>' . $charsetEncoder->encodeEntities($key2, PhpXmlRpc::$xmlrpc_internalencoding, $charsetEncoding) . "</name>\n"; |
|
347 | + $rs .= '<member><name>'.$charsetEncoder->encodeEntities($key2, PhpXmlRpc::$xmlrpc_internalencoding, $charsetEncoding)."</name>\n"; |
|
348 | 348 | //$rs.=$this->serializeval($val2); |
349 | 349 | $rs .= $val2->serialize($charsetEncoding); |
350 | 350 | $rs .= "</member>\n"; |
@@ -379,7 +379,7 @@ discard block |
||
379 | 379 | $val = reset($this->me); |
380 | 380 | $typ = key($this->me); |
381 | 381 | |
382 | - return '<value>' . $this->serializedata($typ, $val, $charsetEncoding) . "</value>\n"; |
|
382 | + return '<value>'.$this->serializedata($typ, $val, $charsetEncoding)."</value>\n"; |
|
383 | 383 | } |
384 | 384 | |
385 | 385 | /** |
@@ -90,13 +90,13 @@ discard block |
||
90 | 90 | 'scalar' => $val, |
91 | 91 | 'timestamp' => \PhpXmlRpc\Helper\Date::iso8601Decode($val) |
92 | 92 | ); |
93 | - return (object)$xmlrpcVal; |
|
93 | + return (object) $xmlrpcVal; |
|
94 | 94 | case 'base64': |
95 | 95 | $xmlrpcVal = array( |
96 | 96 | 'xmlrpc_type' => 'base64', |
97 | 97 | 'scalar' => $val |
98 | 98 | ); |
99 | - return (object)$xmlrpcVal; |
|
99 | + return (object) $xmlrpcVal; |
|
100 | 100 | case 'string': |
101 | 101 | if (isset($options['extension_api_encoding'])) { |
102 | 102 | // if iconv is not available, we use mb_convert_encoding |
@@ -165,7 +165,7 @@ discard block |
||
165 | 165 | case 'msg': |
166 | 166 | $paramCount = $xmlrpcVal->getNumParams(); |
167 | 167 | $arr = array(); |
168 | - for ($i = 0; $i < $paramCount; $i++) { |
|
168 | + for ($i = 0; $i<$paramCount; $i++) { |
|
169 | 169 | $arr[] = $this->decode($xmlrpcVal->getParam($i), $options); |
170 | 170 | } |
171 | 171 | return $arr; |
@@ -291,7 +291,7 @@ discard block |
||
291 | 291 | break; |
292 | 292 | case 'resource': |
293 | 293 | if (in_array('extension_api', $options)) { |
294 | - $xmlrpcVal = new Value((int)$phpVal, Value::$xmlrpcInt); |
|
294 | + $xmlrpcVal = new Value((int) $phpVal, Value::$xmlrpcInt); |
|
295 | 295 | } else { |
296 | 296 | $xmlrpcVal = new Value(); |
297 | 297 | } |
@@ -340,7 +340,7 @@ discard block |
||
340 | 340 | if ($valEncoding == 'ISO-8859-1') { |
341 | 341 | $xmlVal = utf8_encode($xmlVal); |
342 | 342 | } else { |
343 | - $this->getLogger()->errorLog('XML-RPC: ' . __METHOD__ . ': invalid charset encoding of xml text: ' . $valEncoding); |
|
343 | + $this->getLogger()->errorLog('XML-RPC: '.__METHOD__.': invalid charset encoding of xml text: '.$valEncoding); |
|
344 | 344 | } |
345 | 345 | } |
346 | 346 | } |
@@ -362,7 +362,7 @@ discard block |
||
362 | 362 | $parserOptions |
363 | 363 | ); |
364 | 364 | |
365 | - if ($xmlRpcParser->_xh['isf'] > 1) { |
|
365 | + if ($xmlRpcParser->_xh['isf']>1) { |
|
366 | 366 | // test that $xmlrpc->_xh['value'] is an obj, too??? |
367 | 367 | |
368 | 368 | $this->getLogger()->errorLog($xmlRpcParser->_xh['isf_reason']); |
@@ -386,7 +386,7 @@ discard block |
||
386 | 386 | |
387 | 387 | case 'methodcall': |
388 | 388 | $req = new Request($xmlRpcParser->_xh['method']); |
389 | - for ($i = 0; $i < count($xmlRpcParser->_xh['params']); $i++) { |
|
389 | + for ($i = 0; $i<count($xmlRpcParser->_xh['params']); $i++) { |
|
390 | 390 | $req->addParam($xmlRpcParser->_xh['params'][$i]); |
391 | 391 | } |
392 | 392 | return $req; |
@@ -45,12 +45,12 @@ discard block |
||
45 | 45 | |
46 | 46 | // read chunk-size, chunk-extension (if any) and crlf |
47 | 47 | // get the position of the linebreak |
48 | - $chunkEnd = strpos($buffer, "\r\n") + 2; |
|
48 | + $chunkEnd = strpos($buffer, "\r\n")+2; |
|
49 | 49 | $temp = substr($buffer, 0, $chunkEnd); |
50 | 50 | $chunkSize = hexdec(trim($temp)); |
51 | 51 | $chunkStart = $chunkEnd; |
52 | - while ($chunkSize > 0) { |
|
53 | - $chunkEnd = strpos($buffer, "\r\n", $chunkStart + $chunkSize); |
|
52 | + while ($chunkSize>0) { |
|
53 | + $chunkEnd = strpos($buffer, "\r\n", $chunkStart+$chunkSize); |
|
54 | 54 | |
55 | 55 | // just in case we got a broken connection |
56 | 56 | if ($chunkEnd == false) { |
@@ -62,19 +62,19 @@ discard block |
||
62 | 62 | } |
63 | 63 | |
64 | 64 | // read chunk-data and crlf |
65 | - $chunk = substr($buffer, $chunkStart, $chunkEnd - $chunkStart); |
|
65 | + $chunk = substr($buffer, $chunkStart, $chunkEnd-$chunkStart); |
|
66 | 66 | // append chunk-data to entity-body |
67 | 67 | $new .= $chunk; |
68 | 68 | // length := length + chunk-size |
69 | 69 | $length += strlen($chunk); |
70 | 70 | // read chunk-size and crlf |
71 | - $chunkStart = $chunkEnd + 2; |
|
71 | + $chunkStart = $chunkEnd+2; |
|
72 | 72 | |
73 | - $chunkEnd = strpos($buffer, "\r\n", $chunkStart) + 2; |
|
73 | + $chunkEnd = strpos($buffer, "\r\n", $chunkStart)+2; |
|
74 | 74 | if ($chunkEnd == false) { |
75 | 75 | break; // just in case we got a broken connection |
76 | 76 | } |
77 | - $temp = substr($buffer, $chunkStart, $chunkEnd - $chunkStart); |
|
77 | + $temp = substr($buffer, $chunkStart, $chunkEnd-$chunkStart); |
|
78 | 78 | $chunkSize = hexdec(trim($temp)); |
79 | 79 | $chunkStart = $chunkEnd; |
80 | 80 | } |
@@ -103,11 +103,11 @@ discard block |
||
103 | 103 | // Look for CR/LF or simple LF as line separator (even though it is not valid http) |
104 | 104 | $pos = strpos($data, "\r\n\r\n"); |
105 | 105 | if ($pos || is_int($pos)) { |
106 | - $bd = $pos + 4; |
|
106 | + $bd = $pos+4; |
|
107 | 107 | } else { |
108 | 108 | $pos = strpos($data, "\n\n"); |
109 | 109 | if ($pos || is_int($pos)) { |
110 | - $bd = $pos + 2; |
|
110 | + $bd = $pos+2; |
|
111 | 111 | } else { |
112 | 112 | // No separation between response headers and body: fault? |
113 | 113 | $bd = 0; |
@@ -117,8 +117,8 @@ discard block |
||
117 | 117 | // this filters out all http headers from proxy. maybe we could take them into account, too? |
118 | 118 | $data = substr($data, $bd); |
119 | 119 | } else { |
120 | - $this->getLogger()->errorLog('XML-RPC: ' . __METHOD__ . ': HTTPS via proxy error, tunnel connection possibly failed'); |
|
121 | - throw new HttpException(PhpXmlRpc::$xmlrpcstr['http_error'] . ' (HTTPS via proxy error, tunnel connection possibly failed)', PhpXmlRpc::$xmlrpcerr['http_error']); |
|
120 | + $this->getLogger()->errorLog('XML-RPC: '.__METHOD__.': HTTPS via proxy error, tunnel connection possibly failed'); |
|
121 | + throw new HttpException(PhpXmlRpc::$xmlrpcstr['http_error'].' (HTTPS via proxy error, tunnel connection possibly failed)', PhpXmlRpc::$xmlrpcerr['http_error']); |
|
122 | 122 | } |
123 | 123 | } |
124 | 124 | |
@@ -151,19 +151,19 @@ discard block |
||
151 | 151 | } |
152 | 152 | |
153 | 153 | if ($httpResponse['status_code'] !== '200') { |
154 | - $errstr = substr($data, 0, strpos($data, "\n") - 1); |
|
155 | - $this->getLogger()->errorLog('XML-RPC: ' . __METHOD__ . ': HTTP error, got response: ' . $errstr); |
|
156 | - throw new HttpException(PhpXmlRpc::$xmlrpcstr['http_error'] . ' (' . $errstr . ')', PhpXmlRpc::$xmlrpcerr['http_error'], null, $httpResponse['status_code']); |
|
154 | + $errstr = substr($data, 0, strpos($data, "\n")-1); |
|
155 | + $this->getLogger()->errorLog('XML-RPC: '.__METHOD__.': HTTP error, got response: '.$errstr); |
|
156 | + throw new HttpException(PhpXmlRpc::$xmlrpcstr['http_error'].' ('.$errstr.')', PhpXmlRpc::$xmlrpcerr['http_error'], null, $httpResponse['status_code']); |
|
157 | 157 | } |
158 | 158 | |
159 | 159 | // be tolerant to usage of \n instead of \r\n to separate headers and data (even though it is not valid http) |
160 | 160 | $pos = strpos($data, "\r\n\r\n"); |
161 | 161 | if ($pos || is_int($pos)) { |
162 | - $bd = $pos + 4; |
|
162 | + $bd = $pos+4; |
|
163 | 163 | } else { |
164 | 164 | $pos = strpos($data, "\n\n"); |
165 | 165 | if ($pos || is_int($pos)) { |
166 | - $bd = $pos + 2; |
|
166 | + $bd = $pos+2; |
|
167 | 167 | } else { |
168 | 168 | // No separation between response headers and body: fault? |
169 | 169 | // we could take some action here instead of going on... |
@@ -177,7 +177,7 @@ discard block |
||
177 | 177 | foreach ($ar as $line) { |
178 | 178 | // take care of multi-line headers and cookies |
179 | 179 | $arr = explode(':', $line, 2); |
180 | - if (count($arr) > 1) { |
|
180 | + if (count($arr)>1) { |
|
181 | 181 | $headerName = strtolower(trim($arr[0])); |
182 | 182 | /// @todo some other headers (the ones that allow a CSV list of values) do allow many values to be |
183 | 183 | /// passed using multiple header lines. |
@@ -194,7 +194,7 @@ discard block |
||
194 | 194 | foreach ($cookies as $cookie) { |
195 | 195 | // glue together all received cookies, using a comma to separate them (same as php does with getallheaders()) |
196 | 196 | if (isset($httpResponse['headers'][$headerName])) { |
197 | - $httpResponse['headers'][$headerName] .= ', ' . trim($cookie); |
|
197 | + $httpResponse['headers'][$headerName] .= ', '.trim($cookie); |
|
198 | 198 | } else { |
199 | 199 | $httpResponse['headers'][$headerName] = trim($cookie); |
200 | 200 | } |
@@ -223,7 +223,7 @@ discard block |
||
223 | 223 | } |
224 | 224 | } elseif (isset($headerName)) { |
225 | 225 | /// @todo version1 cookies might span multiple lines, thus breaking the parsing above |
226 | - $httpResponse['headers'][$headerName] .= ' ' . trim($line); |
|
226 | + $httpResponse['headers'][$headerName] .= ' '.trim($line); |
|
227 | 227 | } |
228 | 228 | } |
229 | 229 | |
@@ -246,7 +246,7 @@ discard block |
||
246 | 246 | // Decode chunked encoding sent by http 1.1 servers |
247 | 247 | if (isset($httpResponse['headers']['transfer-encoding']) && $httpResponse['headers']['transfer-encoding'] == 'chunked') { |
248 | 248 | if (!$data = static::decodeChunked($data)) { |
249 | - $this->getLogger()->errorLog('XML-RPC: ' . __METHOD__ . ': errors occurred when trying to rebuild the chunked data received from server'); |
|
249 | + $this->getLogger()->errorLog('XML-RPC: '.__METHOD__.': errors occurred when trying to rebuild the chunked data received from server'); |
|
250 | 250 | throw new HttpException(PhpXmlRpc::$xmlrpcstr['dechunk_fail'], PhpXmlRpc::$xmlrpcerr['dechunk_fail'], null, $httpResponse['status_code']); |
251 | 251 | } |
252 | 252 | } |
@@ -261,19 +261,19 @@ discard block |
||
261 | 261 | if ($httpResponse['headers']['content-encoding'] == 'deflate' && $degzdata = @gzuncompress($data)) { |
262 | 262 | $data = $degzdata; |
263 | 263 | if ($debug) { |
264 | - $this->getLogger()->debugMessage("---INFLATED RESPONSE---[" . strlen($data) . " chars]---\n$data\n---END---"); |
|
264 | + $this->getLogger()->debugMessage("---INFLATED RESPONSE---[".strlen($data)." chars]---\n$data\n---END---"); |
|
265 | 265 | } |
266 | 266 | } elseif ($httpResponse['headers']['content-encoding'] == 'gzip' && $degzdata = @gzinflate(substr($data, 10))) { |
267 | 267 | $data = $degzdata; |
268 | 268 | if ($debug) { |
269 | - $this->getLogger()->debugMessage("---INFLATED RESPONSE---[" . strlen($data) . " chars]---\n$data\n---END---"); |
|
269 | + $this->getLogger()->debugMessage("---INFLATED RESPONSE---[".strlen($data)." chars]---\n$data\n---END---"); |
|
270 | 270 | } |
271 | 271 | } else { |
272 | - $this->getLogger()->errorLog('XML-RPC: ' . __METHOD__ . ': errors occurred when trying to decode the deflated data received from server'); |
|
272 | + $this->getLogger()->errorLog('XML-RPC: '.__METHOD__.': errors occurred when trying to decode the deflated data received from server'); |
|
273 | 273 | throw new HttpException(PhpXmlRpc::$xmlrpcstr['decompress_fail'], PhpXmlRpc::$xmlrpcerr['decompress_fail'], null, $httpResponse['status_code']); |
274 | 274 | } |
275 | 275 | } else { |
276 | - $this->getLogger()->errorLog('XML-RPC: ' . __METHOD__ . ': the server sent deflated data. Your php install must have the Zlib extension compiled in to support this.'); |
|
276 | + $this->getLogger()->errorLog('XML-RPC: '.__METHOD__.': the server sent deflated data. Your php install must have the Zlib extension compiled in to support this.'); |
|
277 | 277 | throw new HttpException(PhpXmlRpc::$xmlrpcstr['cannot_decompress'], PhpXmlRpc::$xmlrpcerr['cannot_decompress'], null, $httpResponse['status_code']); |
278 | 278 | } |
279 | 279 | } |
@@ -293,7 +293,7 @@ discard block |
||
293 | 293 | public function parseAcceptHeader($header) |
294 | 294 | { |
295 | 295 | $accepted = array(); |
296 | - foreach(explode(',', $header) as $c) { |
|
296 | + foreach (explode(',', $header) as $c) { |
|
297 | 297 | if (preg_match('/^([^;]+); *q=([0-9.]+)/', $c, $matches)) { |
298 | 298 | $c = $matches[1]; |
299 | 299 | $w = $matches[2]; |
@@ -155,35 +155,35 @@ discard block |
||
155 | 155 | public function serialize($charsetEncoding = '') |
156 | 156 | { |
157 | 157 | if ($charsetEncoding != '') { |
158 | - $this->content_type = 'text/xml; charset=' . $charsetEncoding; |
|
158 | + $this->content_type = 'text/xml; charset='.$charsetEncoding; |
|
159 | 159 | } else { |
160 | 160 | $this->content_type = 'text/xml'; |
161 | 161 | } |
162 | 162 | if (PhpXmlRpc::$xmlrpc_null_apache_encoding) { |
163 | - $result = "<methodResponse xmlns:ex=\"" . PhpXmlRpc::$xmlrpc_null_apache_encoding_ns . "\">\n"; |
|
163 | + $result = "<methodResponse xmlns:ex=\"".PhpXmlRpc::$xmlrpc_null_apache_encoding_ns."\">\n"; |
|
164 | 164 | } else { |
165 | 165 | $result = "<methodResponse>\n"; |
166 | 166 | } |
167 | 167 | if ($this->errno) { |
168 | 168 | // Let non-ASCII response messages be tolerated by clients by xml-encoding non ascii chars |
169 | - $result .= "<fault>\n" . |
|
170 | - "<value>\n<struct><member><name>faultCode</name>\n<value><int>" . $this->errno . |
|
171 | - "</int></value>\n</member>\n<member>\n<name>faultString</name>\n<value><string>" . |
|
172 | - $this->getCharsetEncoder()->encodeEntities($this->errstr, PhpXmlRpc::$xmlrpc_internalencoding, $charsetEncoding) . "</string></value>\n</member>\n" . |
|
169 | + $result .= "<fault>\n". |
|
170 | + "<value>\n<struct><member><name>faultCode</name>\n<value><int>".$this->errno. |
|
171 | + "</int></value>\n</member>\n<member>\n<name>faultString</name>\n<value><string>". |
|
172 | + $this->getCharsetEncoder()->encodeEntities($this->errstr, PhpXmlRpc::$xmlrpc_internalencoding, $charsetEncoding)."</string></value>\n</member>\n". |
|
173 | 173 | "</struct>\n</value>\n</fault>"; |
174 | 174 | } else { |
175 | 175 | if (!is_object($this->val) || !is_a($this->val, 'PhpXmlRpc\Value')) { |
176 | 176 | if (is_string($this->val) && $this->valtyp == 'xml') { |
177 | - $result .= "<params>\n<param>\n" . |
|
178 | - $this->val . |
|
177 | + $result .= "<params>\n<param>\n". |
|
178 | + $this->val. |
|
179 | 179 | "</param>\n</params>"; |
180 | 180 | } else { |
181 | 181 | /// @todo try to build something serializable using the Encoder... |
182 | 182 | throw new \Exception('cannot serialize xmlrpc response objects whose content is native php values'); |
183 | 183 | } |
184 | 184 | } else { |
185 | - $result .= "<params>\n<param>\n" . |
|
186 | - $this->val->serialize($charsetEncoding) . |
|
185 | + $result .= "<params>\n<param>\n". |
|
186 | + $this->val->serialize($charsetEncoding). |
|
187 | 187 | "</param>\n</params>"; |
188 | 188 | } |
189 | 189 | } |
@@ -208,7 +208,7 @@ discard block |
||
208 | 208 | return $this->httpResponse['raw_data']; |
209 | 209 | default: |
210 | 210 | $trace = debug_backtrace(DEBUG_BACKTRACE_IGNORE_ARGS); |
211 | - trigger_error('Undefined property via __get(): ' . $name . ' in ' . $trace[0]['file'] . ' on line ' . $trace[0]['line'], E_USER_WARNING); |
|
211 | + trigger_error('Undefined property via __get(): '.$name.' in '.$trace[0]['file'].' on line '.$trace[0]['line'], E_USER_WARNING); |
|
212 | 212 | return null; |
213 | 213 | } |
214 | 214 | } |
@@ -229,7 +229,7 @@ discard block |
||
229 | 229 | break; |
230 | 230 | default: |
231 | 231 | $trace = debug_backtrace(DEBUG_BACKTRACE_IGNORE_ARGS); |
232 | - trigger_error('Undefined property via __set(): ' . $name . ' in ' . $trace[0]['file'] . ' on line ' . $trace[0]['line'], E_USER_WARNING); |
|
232 | + trigger_error('Undefined property via __set(): '.$name.' in '.$trace[0]['file'].' on line '.$trace[0]['line'], E_USER_WARNING); |
|
233 | 233 | } |
234 | 234 | } |
235 | 235 | |
@@ -263,7 +263,7 @@ discard block |
||
263 | 263 | break; |
264 | 264 | default: |
265 | 265 | $trace = debug_backtrace(DEBUG_BACKTRACE_IGNORE_ARGS); |
266 | - trigger_error('Undefined property via __unset(): ' . $name . ' in ' . $trace[0]['file'] . ' on line ' . $trace[0]['line'], E_USER_WARNING); |
|
266 | + trigger_error('Undefined property via __unset(): '.$name.' in '.$trace[0]['file'].' on line '.$trace[0]['line'], E_USER_WARNING); |
|
267 | 267 | } |
268 | 268 | } |
269 | 269 | } |
@@ -194,10 +194,10 @@ discard block |
||
194 | 194 | $server = $parts['host']; |
195 | 195 | $path = isset($parts['path']) ? $parts['path'] : ''; |
196 | 196 | if (isset($parts['query'])) { |
197 | - $path .= '?' . $parts['query']; |
|
197 | + $path .= '?'.$parts['query']; |
|
198 | 198 | } |
199 | 199 | if (isset($parts['fragment'])) { |
200 | - $path .= '#' . $parts['fragment']; |
|
200 | + $path .= '#'.$parts['fragment']; |
|
201 | 201 | } |
202 | 202 | if (isset($parts['port'])) { |
203 | 203 | $port = $parts['port']; |
@@ -213,7 +213,7 @@ discard block |
||
213 | 213 | } |
214 | 214 | } |
215 | 215 | if ($path == '' || $path[0] != '/') { |
216 | - $this->path = '/' . $path; |
|
216 | + $this->path = '/'.$path; |
|
217 | 217 | } else { |
218 | 218 | $this->path = $path; |
219 | 219 | } |
@@ -245,7 +245,7 @@ discard block |
||
245 | 245 | //$this->accepted_charset_encodings = $ch->knownCharsets(); |
246 | 246 | |
247 | 247 | // initialize user_agent string |
248 | - $this->user_agent = PhpXmlRpc::$xmlrpcName . ' ' . PhpXmlRpc::$xmlrpcVersion; |
|
248 | + $this->user_agent = PhpXmlRpc::$xmlrpcName.' '.PhpXmlRpc::$xmlrpcVersion; |
|
249 | 249 | } |
250 | 250 | |
251 | 251 | /** |
@@ -669,7 +669,7 @@ discard block |
||
669 | 669 | */ |
670 | 670 | protected function sendPayloadHTTP10($req, $server, $port, $timeout = 0, $username = '', $password = '', |
671 | 671 | $authType = 1, $proxyHost = '', $proxyPort = 0, $proxyUsername = '', $proxyPassword = '', $proxyAuthType = 1, |
672 | - $method='http') |
|
672 | + $method = 'http') |
|
673 | 673 | { |
674 | 674 | //trigger_error('Method ' . __METHOD__ . ' is deprecated', E_USER_DEPRECATED); |
675 | 675 | |
@@ -702,7 +702,7 @@ discard block |
||
702 | 702 | * @param int $sslVersion |
703 | 703 | * @return Response |
704 | 704 | */ |
705 | - protected function sendPayloadHTTPS($req, $server, $port, $timeout = 0, $username = '', $password = '', |
|
705 | + protected function sendPayloadHTTPS($req, $server, $port, $timeout = 0, $username = '', $password = '', |
|
706 | 706 | $authType = 1, $cert = '', $certPass = '', $caCert = '', $caCertDir = '', $proxyHost = '', $proxyPort = 0, |
707 | 707 | $proxyUsername = '', $proxyPassword = '', $proxyAuthType = 1, $keepAlive = false, $key = '', $keyPass = '', |
708 | 708 | $sslVersion = 0) |
@@ -741,7 +741,7 @@ discard block |
||
741 | 741 | */ |
742 | 742 | protected function sendPayloadSocket($req, $server, $port, $timeout = 0, $username = '', $password = '', |
743 | 743 | $authType = 1, $cert = '', $certPass = '', $caCert = '', $caCertDir = '', $proxyHost = '', $proxyPort = 0, |
744 | - $proxyUsername = '', $proxyPassword = '', $proxyAuthType = 1, $method='http', $key = '', $keyPass = '', |
|
744 | + $proxyUsername = '', $proxyPassword = '', $proxyAuthType = 1, $method = 'http', $key = '', $keyPass = '', |
|
745 | 745 | $sslVersion = 0) |
746 | 746 | { |
747 | 747 | /// @todo log a warning if passed an unsupported method |
@@ -778,16 +778,16 @@ discard block |
||
778 | 778 | // thanks to Grant Rauscher <[email protected]> for this |
779 | 779 | $credentials = ''; |
780 | 780 | if ($username != '') { |
781 | - $credentials = 'Authorization: Basic ' . base64_encode($username . ':' . $password) . "\r\n"; |
|
781 | + $credentials = 'Authorization: Basic '.base64_encode($username.':'.$password)."\r\n"; |
|
782 | 782 | if ($authType != 1) { |
783 | 783 | /// @todo make this a proper error, i.e. return a failure |
784 | - $this->getLogger()->errorLog('XML-RPC: ' . __METHOD__ . ': warning. Only Basic auth is supported with HTTP 1.0'); |
|
784 | + $this->getLogger()->errorLog('XML-RPC: '.__METHOD__.': warning. Only Basic auth is supported with HTTP 1.0'); |
|
785 | 785 | } |
786 | 786 | } |
787 | 787 | |
788 | 788 | $acceptedEncoding = ''; |
789 | 789 | if (is_array($this->accepted_compression) && count($this->accepted_compression)) { |
790 | - $acceptedEncoding = 'Accept-Encoding: ' . implode(', ', $this->accepted_compression) . "\r\n"; |
|
790 | + $acceptedEncoding = 'Accept-Encoding: '.implode(', ', $this->accepted_compression)."\r\n"; |
|
791 | 791 | } |
792 | 792 | |
793 | 793 | $proxyCredentials = ''; |
@@ -799,13 +799,13 @@ discard block |
||
799 | 799 | $connectPort = $proxyPort; |
800 | 800 | $transport = 'tcp'; |
801 | 801 | /// @todo check: should we not use https in some cases? |
802 | - $uri = 'http://' . $server . ':' . $port . $this->path; |
|
802 | + $uri = 'http://'.$server.':'.$port.$this->path; |
|
803 | 803 | if ($proxyUsername != '') { |
804 | 804 | if ($proxyAuthType != 1) { |
805 | 805 | /// @todo make this a proper error, i.e. return a failure |
806 | - $this->getLogger()->errorLog('XML-RPC: ' . __METHOD__ . ': warning. Only Basic auth to proxy is supported with HTTP 1.0'); |
|
806 | + $this->getLogger()->errorLog('XML-RPC: '.__METHOD__.': warning. Only Basic auth to proxy is supported with HTTP 1.0'); |
|
807 | 807 | } |
808 | - $proxyCredentials = 'Proxy-Authorization: Basic ' . base64_encode($proxyUsername . ':' . $proxyPassword) . "\r\n"; |
|
808 | + $proxyCredentials = 'Proxy-Authorization: Basic '.base64_encode($proxyUsername.':'.$proxyPassword)."\r\n"; |
|
809 | 809 | } |
810 | 810 | } else { |
811 | 811 | $connectServer = $server; |
@@ -820,45 +820,45 @@ discard block |
||
820 | 820 | $version = ''; |
821 | 821 | foreach ($this->cookies as $name => $cookie) { |
822 | 822 | if ($cookie['version']) { |
823 | - $version = ' $Version="' . $cookie['version'] . '";'; |
|
824 | - $cookieHeader .= ' ' . $name . '="' . $cookie['value'] . '";'; |
|
823 | + $version = ' $Version="'.$cookie['version'].'";'; |
|
824 | + $cookieHeader .= ' '.$name.'="'.$cookie['value'].'";'; |
|
825 | 825 | if ($cookie['path']) { |
826 | - $cookieHeader .= ' $Path="' . $cookie['path'] . '";'; |
|
826 | + $cookieHeader .= ' $Path="'.$cookie['path'].'";'; |
|
827 | 827 | } |
828 | 828 | if ($cookie['domain']) { |
829 | - $cookieHeader .= ' $Domain="' . $cookie['domain'] . '";'; |
|
829 | + $cookieHeader .= ' $Domain="'.$cookie['domain'].'";'; |
|
830 | 830 | } |
831 | 831 | if ($cookie['port']) { |
832 | - $cookieHeader .= ' $Port="' . $cookie['port'] . '";'; |
|
832 | + $cookieHeader .= ' $Port="'.$cookie['port'].'";'; |
|
833 | 833 | } |
834 | 834 | } else { |
835 | - $cookieHeader .= ' ' . $name . '=' . $cookie['value'] . ";"; |
|
835 | + $cookieHeader .= ' '.$name.'='.$cookie['value'].";"; |
|
836 | 836 | } |
837 | 837 | } |
838 | - $cookieHeader = 'Cookie:' . $version . substr($cookieHeader, 0, -1) . "\r\n"; |
|
838 | + $cookieHeader = 'Cookie:'.$version.substr($cookieHeader, 0, -1)."\r\n"; |
|
839 | 839 | } |
840 | 840 | |
841 | 841 | // omit port if default |
842 | 842 | if (($port == 80 && in_array($method, array('http', 'http10'))) || ($port == 443 && $method == 'https')) { |
843 | - $port = ''; |
|
843 | + $port = ''; |
|
844 | 844 | } else { |
845 | - $port = ':' . $port; |
|
845 | + $port = ':'.$port; |
|
846 | 846 | } |
847 | 847 | |
848 | - $op = 'POST ' . $uri . " HTTP/1.0\r\n" . |
|
849 | - 'User-Agent: ' . $this->user_agent . "\r\n" . |
|
850 | - 'Host: ' . $server . $port . "\r\n" . |
|
851 | - $credentials . |
|
852 | - $proxyCredentials . |
|
853 | - $acceptedEncoding . |
|
854 | - $encodingHdr . |
|
855 | - 'Accept-Charset: ' . implode(',', $this->accepted_charset_encodings) . "\r\n" . |
|
856 | - $cookieHeader . |
|
857 | - 'Content-Type: ' . $req->content_type . "\r\nContent-Length: " . |
|
858 | - strlen($payload) . "\r\n\r\n" . |
|
848 | + $op = 'POST '.$uri." HTTP/1.0\r\n". |
|
849 | + 'User-Agent: '.$this->user_agent."\r\n". |
|
850 | + 'Host: '.$server.$port."\r\n". |
|
851 | + $credentials. |
|
852 | + $proxyCredentials. |
|
853 | + $acceptedEncoding. |
|
854 | + $encodingHdr. |
|
855 | + 'Accept-Charset: '.implode(',', $this->accepted_charset_encodings)."\r\n". |
|
856 | + $cookieHeader. |
|
857 | + 'Content-Type: '.$req->content_type."\r\nContent-Length: ". |
|
858 | + strlen($payload)."\r\n\r\n". |
|
859 | 859 | $payload; |
860 | 860 | |
861 | - if ($this->debug > 1) { |
|
861 | + if ($this->debug>1) { |
|
862 | 862 | $this->getLogger()->debugMessage("---SENDING---\n$op\n---END---"); |
863 | 863 | } |
864 | 864 | |
@@ -885,7 +885,7 @@ discard block |
||
885 | 885 | |
886 | 886 | $context = stream_context_create($contextOptions); |
887 | 887 | |
888 | - if ($timeout <= 0) { |
|
888 | + if ($timeout<=0) { |
|
889 | 889 | $connectTimeout = ini_get('default_socket_timeout'); |
890 | 890 | } else { |
891 | 891 | $connectTimeout = $timeout; |
@@ -897,7 +897,7 @@ discard block |
||
897 | 897 | $fp = @stream_socket_client("$transport://$connectServer:$connectPort", $this->errno, $this->errstr, $connectTimeout, |
898 | 898 | STREAM_CLIENT_CONNECT, $context); |
899 | 899 | if ($fp) { |
900 | - if ($timeout > 0) { |
|
900 | + if ($timeout>0) { |
|
901 | 901 | stream_set_timeout($fp, $timeout, 0); |
902 | 902 | } |
903 | 903 | } else { |
@@ -906,8 +906,8 @@ discard block |
||
906 | 906 | $this->errstr = $err['message']; |
907 | 907 | } |
908 | 908 | |
909 | - $this->errstr = 'Connect error: ' . $this->errstr; |
|
910 | - $r = new static::$responseClass(0, PhpXmlRpc::$xmlrpcerr['http_error'], $this->errstr . ' (' . $this->errno . ')'); |
|
909 | + $this->errstr = 'Connect error: '.$this->errstr; |
|
910 | + $r = new static::$responseClass(0, PhpXmlRpc::$xmlrpcerr['http_error'], $this->errstr.' ('.$this->errno.')'); |
|
911 | 911 | |
912 | 912 | return $r; |
913 | 913 | } |
@@ -995,18 +995,18 @@ discard block |
||
995 | 995 | $keyPass, $sslVersion); |
996 | 996 | |
997 | 997 | if (!$curl) { |
998 | - return new static::$responseClass(0, PhpXmlRpc::$xmlrpcerr['curl_fail'], PhpXmlRpc::$xmlrpcstr['curl_fail'] . ': error during curl initialization. Check php error log for details'); |
|
998 | + return new static::$responseClass(0, PhpXmlRpc::$xmlrpcerr['curl_fail'], PhpXmlRpc::$xmlrpcstr['curl_fail'].': error during curl initialization. Check php error log for details'); |
|
999 | 999 | } |
1000 | 1000 | |
1001 | 1001 | $result = curl_exec($curl); |
1002 | 1002 | |
1003 | - if ($this->debug > 1) { |
|
1003 | + if ($this->debug>1) { |
|
1004 | 1004 | $message = "---CURL INFO---\n"; |
1005 | 1005 | foreach (curl_getinfo($curl) as $name => $val) { |
1006 | 1006 | if (is_array($val)) { |
1007 | 1007 | $val = implode("\n", $val); |
1008 | 1008 | } |
1009 | - $message .= $name . ': ' . $val . "\n"; |
|
1009 | + $message .= $name.': '.$val."\n"; |
|
1010 | 1010 | } |
1011 | 1011 | $message .= '---END---'; |
1012 | 1012 | $this->getLogger()->debugMessage($message); |
@@ -1016,7 +1016,7 @@ discard block |
||
1016 | 1016 | /// @todo we should use a better check here - what if we get back '' or '0'? |
1017 | 1017 | |
1018 | 1018 | $this->errstr = 'no response'; |
1019 | - $resp = new static::$responseClass(0, PhpXmlRpc::$xmlrpcerr['curl_fail'], PhpXmlRpc::$xmlrpcstr['curl_fail'] . ': ' . curl_error($curl)); |
|
1019 | + $resp = new static::$responseClass(0, PhpXmlRpc::$xmlrpcerr['curl_fail'], PhpXmlRpc::$xmlrpcstr['curl_fail'].': '.curl_error($curl)); |
|
1020 | 1020 | curl_close($curl); |
1021 | 1021 | if ($keepAlive) { |
1022 | 1022 | $this->xmlrpc_curl_handle = null; |
@@ -1086,12 +1086,12 @@ discard block |
||
1086 | 1086 | // http, https |
1087 | 1087 | $protocol = $method; |
1088 | 1088 | if (strpos($protocol, ':') !== false) { |
1089 | - $this->getLogger()->errorLog('XML-RPC: ' . __METHOD__ . ": warning - attempted hacking attempt?. The curl protocol requested for the call is: '$protocol'"); |
|
1089 | + $this->getLogger()->errorLog('XML-RPC: '.__METHOD__.": warning - attempted hacking attempt?. The curl protocol requested for the call is: '$protocol'"); |
|
1090 | 1090 | return false; |
1091 | 1091 | } |
1092 | 1092 | } |
1093 | 1093 | } |
1094 | - $curl = curl_init($protocol . '://' . $server . ':' . $port . $this->path); |
|
1094 | + $curl = curl_init($protocol.'://'.$server.':'.$port.$this->path); |
|
1095 | 1095 | if (!$curl) { |
1096 | 1096 | return false; |
1097 | 1097 | } |
@@ -1105,7 +1105,7 @@ discard block |
||
1105 | 1105 | // results into variable |
1106 | 1106 | curl_setopt($curl, CURLOPT_RETURNTRANSFER, true); |
1107 | 1107 | |
1108 | - if ($this->debug > 1) { |
|
1108 | + if ($this->debug>1) { |
|
1109 | 1109 | curl_setopt($curl, CURLOPT_VERBOSE, true); |
1110 | 1110 | /// @todo allow callers to redirect curlopt_stderr to some stream which can be buffered |
1111 | 1111 | } |
@@ -1130,7 +1130,7 @@ discard block |
||
1130 | 1130 | } |
1131 | 1131 | } |
1132 | 1132 | // extra headers |
1133 | - $headers = array('Content-Type: ' . $req->content_type, 'Accept-Charset: ' . implode(',', $this->accepted_charset_encodings)); |
|
1133 | + $headers = array('Content-Type: '.$req->content_type, 'Accept-Charset: '.implode(',', $this->accepted_charset_encodings)); |
|
1134 | 1134 | // if no keepalive is wanted, let the server know it in advance |
1135 | 1135 | if (!$keepAlive) { |
1136 | 1136 | $headers[] = 'Connection: close'; |
@@ -1147,7 +1147,7 @@ discard block |
||
1147 | 1147 | curl_setopt($curl, CURLOPT_HTTPHEADER, $headers); |
1148 | 1148 | // timeout is borked |
1149 | 1149 | if ($timeout) { |
1150 | - curl_setopt($curl, CURLOPT_TIMEOUT, $timeout == 1 ? 1 : $timeout - 1); |
|
1150 | + curl_setopt($curl, CURLOPT_TIMEOUT, $timeout == 1 ? 1 : $timeout-1); |
|
1151 | 1151 | } |
1152 | 1152 | |
1153 | 1153 | switch ($method) { |
@@ -1162,7 +1162,7 @@ discard block |
||
1162 | 1162 | curl_setopt($curl, CURLOPT_HTTP_VERSION, CURL_HTTP_VERSION_2_PRIOR_KNOWLEDGE); |
1163 | 1163 | } else { |
1164 | 1164 | /// @todo make this a proper error, i.e. return a failure |
1165 | - $this->getLogger()->errorLog('XML-RPC: ' . __METHOD__ . ': warning. HTTP2 is not supported by the current PHP/curl install'); |
|
1165 | + $this->getLogger()->errorLog('XML-RPC: '.__METHOD__.': warning. HTTP2 is not supported by the current PHP/curl install'); |
|
1166 | 1166 | } |
1167 | 1167 | break; |
1168 | 1168 | case 'h2': |
@@ -1171,12 +1171,12 @@ discard block |
||
1171 | 1171 | } |
1172 | 1172 | |
1173 | 1173 | if ($username && $password) { |
1174 | - curl_setopt($curl, CURLOPT_USERPWD, $username . ':' . $password); |
|
1174 | + curl_setopt($curl, CURLOPT_USERPWD, $username.':'.$password); |
|
1175 | 1175 | if (defined('CURLOPT_HTTPAUTH')) { |
1176 | 1176 | curl_setopt($curl, CURLOPT_HTTPAUTH, $authType); |
1177 | 1177 | } elseif ($authType != 1) { |
1178 | 1178 | /// @todo make this a proper error, i.e. return a failure |
1179 | - $this->getLogger()->errorLog('XML-RPC: ' . __METHOD__ . ': warning. Only Basic auth is supported by the current PHP/curl install'); |
|
1179 | + $this->getLogger()->errorLog('XML-RPC: '.__METHOD__.': warning. Only Basic auth is supported by the current PHP/curl install'); |
|
1180 | 1180 | } |
1181 | 1181 | } |
1182 | 1182 | |
@@ -1219,14 +1219,14 @@ discard block |
||
1219 | 1219 | if ($proxyPort == 0) { |
1220 | 1220 | $proxyPort = 8080; // NB: even for HTTPS, local connection is on port 8080 |
1221 | 1221 | } |
1222 | - curl_setopt($curl, CURLOPT_PROXY, $proxyHost . ':' . $proxyPort); |
|
1222 | + curl_setopt($curl, CURLOPT_PROXY, $proxyHost.':'.$proxyPort); |
|
1223 | 1223 | if ($proxyUsername) { |
1224 | - curl_setopt($curl, CURLOPT_PROXYUSERPWD, $proxyUsername . ':' . $proxyPassword); |
|
1224 | + curl_setopt($curl, CURLOPT_PROXYUSERPWD, $proxyUsername.':'.$proxyPassword); |
|
1225 | 1225 | if (defined('CURLOPT_PROXYAUTH')) { |
1226 | 1226 | curl_setopt($curl, CURLOPT_PROXYAUTH, $proxyAuthType); |
1227 | 1227 | } elseif ($proxyAuthType != 1) { |
1228 | 1228 | /// @todo make this a proper error, i.e. return a failure |
1229 | - $this->getLogger()->errorLog('XML-RPC: ' . __METHOD__ . ': warning. Only Basic auth to proxy is supported by the current PHP/curl install'); |
|
1229 | + $this->getLogger()->errorLog('XML-RPC: '.__METHOD__.': warning. Only Basic auth to proxy is supported by the current PHP/curl install'); |
|
1230 | 1230 | } |
1231 | 1231 | } |
1232 | 1232 | } |
@@ -1236,7 +1236,7 @@ discard block |
||
1236 | 1236 | if (count($this->cookies)) { |
1237 | 1237 | $cookieHeader = ''; |
1238 | 1238 | foreach ($this->cookies as $name => $cookie) { |
1239 | - $cookieHeader .= $name . '=' . $cookie['value'] . '; '; |
|
1239 | + $cookieHeader .= $name.'='.$cookie['value'].'; '; |
|
1240 | 1240 | } |
1241 | 1241 | curl_setopt($curl, CURLOPT_COOKIE, substr($cookieHeader, 0, -2)); |
1242 | 1242 | } |
@@ -1245,7 +1245,7 @@ discard block |
||
1245 | 1245 | curl_setopt($curl, $opt, $val); |
1246 | 1246 | } |
1247 | 1247 | |
1248 | - if ($this->debug > 1) { |
|
1248 | + if ($this->debug>1) { |
|
1249 | 1249 | $this->getLogger()->debugMessage("---SENDING---\n$payload\n---END---"); |
1250 | 1250 | } |
1251 | 1251 | |
@@ -1336,7 +1336,7 @@ discard block |
||
1336 | 1336 | $call['methodName'] = new Value($req->method(), 'string'); |
1337 | 1337 | $numParams = $req->getNumParams(); |
1338 | 1338 | $params = array(); |
1339 | - for ($i = 0; $i < $numParams; $i++) { |
|
1339 | + for ($i = 0; $i<$numParams; $i++) { |
|
1340 | 1340 | $params[$i] = $req->getParam($i); |
1341 | 1341 | } |
1342 | 1342 | $call['params'] = new Value($params, 'array'); |
@@ -1358,7 +1358,7 @@ discard block |
||
1358 | 1358 | $response = array(); |
1359 | 1359 | |
1360 | 1360 | if ($this->return_type == 'xml') { |
1361 | - for ($i = 0; $i < count($reqs); $i++) { |
|
1361 | + for ($i = 0; $i<count($reqs); $i++) { |
|
1362 | 1362 | $response[] = new Response($rets, 0, '', 'xml', $result->httpResponse()); |
1363 | 1363 | } |
1364 | 1364 | |
@@ -1366,21 +1366,21 @@ discard block |
||
1366 | 1366 | if (!is_array($rets)) { |
1367 | 1367 | // bad return type from system.multicall |
1368 | 1368 | return new Response(0, PhpXmlRpc::$xmlrpcerr['multicall_error'], |
1369 | - PhpXmlRpc::$xmlrpcstr['multicall_error'] . ': not an array', 'phpvals', $result->httpResponse()); |
|
1369 | + PhpXmlRpc::$xmlrpcstr['multicall_error'].': not an array', 'phpvals', $result->httpResponse()); |
|
1370 | 1370 | } |
1371 | 1371 | $numRets = count($rets); |
1372 | 1372 | if ($numRets != count($reqs)) { |
1373 | 1373 | // wrong number of return values. |
1374 | 1374 | return new Response(0, PhpXmlRpc::$xmlrpcerr['multicall_error'], |
1375 | - PhpXmlRpc::$xmlrpcstr['multicall_error'] . ': incorrect number of responses', 'phpvals', |
|
1375 | + PhpXmlRpc::$xmlrpcstr['multicall_error'].': incorrect number of responses', 'phpvals', |
|
1376 | 1376 | $result->httpResponse()); |
1377 | 1377 | } |
1378 | 1378 | |
1379 | - for ($i = 0; $i < $numRets; $i++) { |
|
1379 | + for ($i = 0; $i<$numRets; $i++) { |
|
1380 | 1380 | $val = $rets[$i]; |
1381 | 1381 | if (!is_array($val)) { |
1382 | 1382 | return new Response(0, PhpXmlRpc::$xmlrpcerr['multicall_error'], |
1383 | - PhpXmlRpc::$xmlrpcstr['multicall_error'] . ": response element $i is not an array or struct", |
|
1383 | + PhpXmlRpc::$xmlrpcstr['multicall_error'].": response element $i is not an array or struct", |
|
1384 | 1384 | 'phpvals', $result->httpResponse()); |
1385 | 1385 | } |
1386 | 1386 | switch (count($val)) { |
@@ -1388,7 +1388,7 @@ discard block |
||
1388 | 1388 | if (!isset($val[0])) { |
1389 | 1389 | // Bad value |
1390 | 1390 | return new Response(0, PhpXmlRpc::$xmlrpcerr['multicall_error'], |
1391 | - PhpXmlRpc::$xmlrpcstr['multicall_error'] . ": response element $i has no value", |
|
1391 | + PhpXmlRpc::$xmlrpcstr['multicall_error'].": response element $i has no value", |
|
1392 | 1392 | 'phpvals', $result->httpResponse()); |
1393 | 1393 | } |
1394 | 1394 | // Normal return value |
@@ -1400,20 +1400,20 @@ discard block |
||
1400 | 1400 | if (!is_int($code)) { |
1401 | 1401 | /// @todo should we check that it is != 0? |
1402 | 1402 | return new Response(0, PhpXmlRpc::$xmlrpcerr['multicall_error'], |
1403 | - PhpXmlRpc::$xmlrpcstr['multicall_error'] . ": response element $i has invalid or no faultCode", |
|
1403 | + PhpXmlRpc::$xmlrpcstr['multicall_error'].": response element $i has invalid or no faultCode", |
|
1404 | 1404 | 'phpvals', $result->httpResponse()); |
1405 | 1405 | } |
1406 | 1406 | $str = @$val['faultString']; |
1407 | 1407 | if (!is_string($str)) { |
1408 | 1408 | return new Response(0, PhpXmlRpc::$xmlrpcerr['multicall_error'], |
1409 | - PhpXmlRpc::$xmlrpcstr['multicall_error'] . ": response element $i has invalid or no FaultString", |
|
1409 | + PhpXmlRpc::$xmlrpcstr['multicall_error'].": response element $i has invalid or no FaultString", |
|
1410 | 1410 | 'phpvals', $result->httpResponse()); |
1411 | 1411 | } |
1412 | 1412 | $response[$i] = new Response(0, $code, $str, 'phpvals', $result->httpResponse()); |
1413 | 1413 | break; |
1414 | 1414 | default: |
1415 | 1415 | return new Response(0, PhpXmlRpc::$xmlrpcerr['multicall_error'], |
1416 | - PhpXmlRpc::$xmlrpcstr['multicall_error'] . ": response element $i has too many items", |
|
1416 | + PhpXmlRpc::$xmlrpcstr['multicall_error'].": response element $i has too many items", |
|
1417 | 1417 | 'phpvals', $result->httpResponse()); |
1418 | 1418 | } |
1419 | 1419 | } |
@@ -1422,14 +1422,14 @@ discard block |
||
1422 | 1422 | // return type == 'xmlrpcvals' |
1423 | 1423 | if ($rets->kindOf() != 'array') { |
1424 | 1424 | return new Response(0, PhpXmlRpc::$xmlrpcerr['multicall_error'], |
1425 | - PhpXmlRpc::$xmlrpcstr['multicall_error'] . ": response element $i is not an array", 'xmlrpcvals', |
|
1425 | + PhpXmlRpc::$xmlrpcstr['multicall_error'].": response element $i is not an array", 'xmlrpcvals', |
|
1426 | 1426 | $result->httpResponse()); |
1427 | 1427 | } |
1428 | 1428 | $numRets = $rets->count(); |
1429 | 1429 | if ($numRets != count($reqs)) { |
1430 | 1430 | // wrong number of return values. |
1431 | 1431 | return new Response(0, PhpXmlRpc::$xmlrpcerr['multicall_error'], |
1432 | - PhpXmlRpc::$xmlrpcstr['multicall_error'] . ': incorrect number of responses', 'xmlrpcvals', |
|
1432 | + PhpXmlRpc::$xmlrpcstr['multicall_error'].': incorrect number of responses', 'xmlrpcvals', |
|
1433 | 1433 | $result->httpResponse()); |
1434 | 1434 | } |
1435 | 1435 | |
@@ -1438,7 +1438,7 @@ discard block |
||
1438 | 1438 | case 'array': |
1439 | 1439 | if ($val->count() != 1) { |
1440 | 1440 | return new Response(0, PhpXmlRpc::$xmlrpcerr['multicall_error'], |
1441 | - PhpXmlRpc::$xmlrpcstr['multicall_error'] . ": response element $i has too many items", |
|
1441 | + PhpXmlRpc::$xmlrpcstr['multicall_error'].": response element $i has too many items", |
|
1442 | 1442 | 'phpvals', $result->httpResponse()); |
1443 | 1443 | } |
1444 | 1444 | // Normal return value |
@@ -1447,28 +1447,28 @@ discard block |
||
1447 | 1447 | case 'struct': |
1448 | 1448 | if ($val->count() != 2) { |
1449 | 1449 | return new Response(0, PhpXmlRpc::$xmlrpcerr['multicall_error'], |
1450 | - PhpXmlRpc::$xmlrpcstr['multicall_error'] . ": response element $i has too many items", |
|
1450 | + PhpXmlRpc::$xmlrpcstr['multicall_error'].": response element $i has too many items", |
|
1451 | 1451 | 'phpvals', $result->httpResponse()); |
1452 | 1452 | } |
1453 | 1453 | /** @var Value $code */ |
1454 | 1454 | $code = $val['faultCode']; |
1455 | 1455 | if ($code->kindOf() != 'scalar' || $code->scalartyp() != 'int') { |
1456 | 1456 | return new Response(0, PhpXmlRpc::$xmlrpcerr['multicall_error'], |
1457 | - PhpXmlRpc::$xmlrpcstr['multicall_error'] . ": response element $i has invalid or no faultCode", |
|
1457 | + PhpXmlRpc::$xmlrpcstr['multicall_error'].": response element $i has invalid or no faultCode", |
|
1458 | 1458 | 'xmlrpcvals', $result->httpResponse()); |
1459 | 1459 | } |
1460 | 1460 | /** @var Value $str */ |
1461 | 1461 | $str = $val['faultString']; |
1462 | 1462 | if ($str->kindOf() != 'scalar' || $str->scalartyp() != 'string') { |
1463 | 1463 | return new Response(0, PhpXmlRpc::$xmlrpcerr['multicall_error'], |
1464 | - PhpXmlRpc::$xmlrpcstr['multicall_error'] . ": response element $i has invalid or no faultCode", |
|
1464 | + PhpXmlRpc::$xmlrpcstr['multicall_error'].": response element $i has invalid or no faultCode", |
|
1465 | 1465 | 'xmlrpcvals', $result->httpResponse()); |
1466 | 1466 | } |
1467 | 1467 | $response[] = new Response(0, $code->scalarval(), $str->scalarval(), 'xmlrpcvals', $result->httpResponse()); |
1468 | 1468 | break; |
1469 | 1469 | default: |
1470 | 1470 | return new Response(0, PhpXmlRpc::$xmlrpcerr['multicall_error'], |
1471 | - PhpXmlRpc::$xmlrpcstr['multicall_error'] . ": response element $i is not an array or struct", |
|
1471 | + PhpXmlRpc::$xmlrpcstr['multicall_error'].": response element $i is not an array or struct", |
|
1472 | 1472 | 'xmlrpcvals', $result->httpResponse()); |
1473 | 1473 | } |
1474 | 1474 | } |
@@ -17,7 +17,7 @@ discard block |
||
17 | 17 | // Make sure we set the correct charset type for output, so that we can display all characters |
18 | 18 | header('Content-Type: text/html; charset=utf-8'); |
19 | 19 | |
20 | -include __DIR__ . '/common.php'; |
|
20 | +include __DIR__.'/common.php'; |
|
21 | 21 | if ($action == '') { |
22 | 22 | $action = 'list'; |
23 | 23 | } |
@@ -33,30 +33,30 @@ discard block |
||
33 | 33 | /// @const JSXMLRPC_PATH Path to the visual xml-rpc editing dialog's containing folder. Can be absolute, or |
34 | 34 | /// relative to this debugger's folder. |
35 | 35 | if (defined('JSXMLRPC_PATH')) { |
36 | - $editorpaths = array(JSXMLRPC_PATH[0] === '/' ? JSXMLRPC_PATH : (__DIR__ . '/' . JSXMLRPC_PATH)); |
|
36 | + $editorpaths = array(JSXMLRPC_PATH[0] === '/' ? JSXMLRPC_PATH : (__DIR__.'/'.JSXMLRPC_PATH)); |
|
37 | 37 | } else { |
38 | 38 | $editorpaths = array( |
39 | - __DIR__ . '/jsxmlrpc/debugger/', // this package is top-level, jsxmlrpc installed via taskfile |
|
40 | - __DIR__ . '/vendor/phpxmlrpc/jsxmlrpc/debugger/', // this package is top-level, jsxmlrpc installed via composer inside the debugger |
|
41 | - __DIR__ . '/node_modules/@jsxmlrpc/jsxmlrpc/debugger/', // this package is top-level, jsxmlrpc installed via npm inside the debugger |
|
42 | - __DIR__ . '/../vendor/phpxmlrpc/jsxmlrpc/debugger/', // this package is top-level, jsxmlrpc installed via composer |
|
43 | - __DIR__ . '/../node_modules/@jsxmlrpc/jsxmlrpc/debugger/', // this package is top-level, jsxmlrpc installed via npm |
|
44 | - __DIR__ . '/../../jsxmlrpc/debugger/', // this package is a composer dependency, jsxmlrpc too |
|
45 | - __DIR__ . '/../../../../debugger/jsxmlrpc/debugger/', // this package is a composer dependency, jsxmlrpc installed in the top-level via taskfile (ie. jsonrpc) |
|
46 | - __DIR__ . '/../../../../debugger/vendor/phpxmlrpc/jsxmlrpc/debugger/', // this package is a composer dependency, jsxmlrpc installed in the top-level debugger via composer |
|
47 | - __DIR__ . '/../../../../debugger/node_modules/@jsxmlrpc/jsxmlrpc/debugger/', // this package is a composer dependency, jsxmlrpc installed in the top-level debugger via npm |
|
48 | - __DIR__ . '/../../../../node_modules/@jsxmlrpc/jsxmlrpc/debugger/', // this package is a composer dependency, jsxmlrpc installed via npm in the top-level project |
|
39 | + __DIR__.'/jsxmlrpc/debugger/', // this package is top-level, jsxmlrpc installed via taskfile |
|
40 | + __DIR__.'/vendor/phpxmlrpc/jsxmlrpc/debugger/', // this package is top-level, jsxmlrpc installed via composer inside the debugger |
|
41 | + __DIR__.'/node_modules/@jsxmlrpc/jsxmlrpc/debugger/', // this package is top-level, jsxmlrpc installed via npm inside the debugger |
|
42 | + __DIR__.'/../vendor/phpxmlrpc/jsxmlrpc/debugger/', // this package is top-level, jsxmlrpc installed via composer |
|
43 | + __DIR__.'/../node_modules/@jsxmlrpc/jsxmlrpc/debugger/', // this package is top-level, jsxmlrpc installed via npm |
|
44 | + __DIR__.'/../../jsxmlrpc/debugger/', // this package is a composer dependency, jsxmlrpc too |
|
45 | + __DIR__.'/../../../../debugger/jsxmlrpc/debugger/', // this package is a composer dependency, jsxmlrpc installed in the top-level via taskfile (ie. jsonrpc) |
|
46 | + __DIR__.'/../../../../debugger/vendor/phpxmlrpc/jsxmlrpc/debugger/', // this package is a composer dependency, jsxmlrpc installed in the top-level debugger via composer |
|
47 | + __DIR__.'/../../../../debugger/node_modules/@jsxmlrpc/jsxmlrpc/debugger/', // this package is a composer dependency, jsxmlrpc installed in the top-level debugger via npm |
|
48 | + __DIR__.'/../../../../node_modules/@jsxmlrpc/jsxmlrpc/debugger/', // this package is a composer dependency, jsxmlrpc installed via npm in the top-level project |
|
49 | 49 | ); |
50 | 50 | } |
51 | - foreach($editorpaths as $editorpath) { |
|
52 | - if (is_file(realpath($editorpath . 'visualeditor.html'))) { |
|
51 | + foreach ($editorpaths as $editorpath) { |
|
52 | + if (is_file(realpath($editorpath.'visualeditor.html'))) { |
|
53 | 53 | $haseditor = true; |
54 | 54 | break; |
55 | 55 | } |
56 | 56 | } |
57 | 57 | if ($haseditor) { |
58 | - $controllerRootUrl = str_replace('/controller.php', '', parse_url($_SERVER['REQUEST_URI'], PHP_URL_PATH)); |
|
59 | - $editorurlpath = $controllerRootUrl . '/' . preg_replace('|^' . preg_quote(__DIR__, '|') .'|', '', $editorpath); |
|
58 | + $controllerRootUrl = str_replace('/controller.php', '', parse_url($_SERVER['REQUEST_URI'], PHP_URL_PATH)); |
|
59 | + $editorurlpath = $controllerRootUrl.'/'.preg_replace('|^'.preg_quote(__DIR__, '|').'|', '', $editorpath); |
|
60 | 60 | /// @todo for cases above 4 and up, look at $controllerRootUrl and check if the web root is not pointing directly |
61 | 61 | /// at this folder, as in that case the link to the visualeditor will not |
62 | 62 | /// work, as it will be in the form http(s)://domain/../../jsxmlrpc/debugger/visualeditor.html |
@@ -233,7 +233,7 @@ discard block |
||
233 | 233 | } |
234 | 234 | |
235 | 235 | function activateeditor() { |
236 | - var url = '<?php echo $editorurlpath; ?>visualeditor.html?params=<?php echo str_replace(array("\\", "'"), array( "\\\\", "\\'"), $alt_payload); ?>'; |
|
236 | + var url = '<?php echo $editorurlpath; ?>visualeditor.html?params=<?php echo str_replace(array("\\", "'"), array("\\\\", "\\'"), $alt_payload); ?>'; |
|
237 | 237 | if (document.frmaction.wstype.value == "1") |
238 | 238 | url += '&type=jsonrpc'; |
239 | 239 | var wnd = window.open(url, '_blank', 'width=750, height=400, location=0, resizable=1, menubar=0, scrollbars=1'); |
@@ -278,7 +278,7 @@ discard block |
||
278 | 278 | JSON-RPC'; |
279 | 279 | } ?> |
280 | 280 | Debugger</h1><h3>(based on <a href="https://gggeek.github.io/phpxmlrpc/">PHPXMLRPC</a>, ver. <?php echo htmlspecialchars(\PhpXmlRpc\PhpXmlRpc::$xmlrpcVersion)?> |
281 | -<?php if (class_exists('\PhpXmlRpc\JsonRpc\PhpJsonRpc')) echo ' and <a href="https://gggeek.github.io/phpxmlrpc-jsonrpc/">PHPJOSNRPC</a>, ver. ' . htmlspecialchars(\PhpXmlRpc\JsonRpc\PhpJsonRpc::$jsonrpcVersion); ?>)</h3> |
|
281 | +<?php if (class_exists('\PhpXmlRpc\JsonRpc\PhpJsonRpc')) echo ' and <a href="https://gggeek.github.io/phpxmlrpc-jsonrpc/">PHPJOSNRPC</a>, ver. '.htmlspecialchars(\PhpXmlRpc\JsonRpc\PhpJsonRpc::$jsonrpcVersion); ?>)</h3> |
|
282 | 282 | <form name="frmaction" method="get" action="action.php" target="frmaction" onSubmit="switchFormMethod();"> |
283 | 283 | |
284 | 284 | <table id="serverblock"> |
@@ -339,7 +339,7 @@ discard block |
||
339 | 339 | </select> |
340 | 340 | </td> |
341 | 341 | <td class="labelcell">Timeout:</td> |
342 | - <td><input type="text" name="timeout" size="3" value="<?php if ($timeout > 0) { echo $timeout; } ?>"/></td> |
|
342 | + <td><input type="text" name="timeout" size="3" value="<?php if ($timeout>0) { echo $timeout; } ?>"/></td> |
|
343 | 343 | <td></td> |
344 | 344 | <td></td> |
345 | 345 | </tr> |