@@ -91,14 +91,14 @@ discard block |
||
91 | 91 | if (count($this->xml_iso88591_Entities['in'])) { |
92 | 92 | return; |
93 | 93 | } |
94 | - for ($i = 0; $i < 32; $i++) { |
|
94 | + for ($i = 0; $i<32; $i++) { |
|
95 | 95 | $this->xml_iso88591_Entities["in"][] = chr($i); |
96 | 96 | $this->xml_iso88591_Entities["out"][] = "&#{$i};"; |
97 | 97 | } |
98 | 98 | |
99 | 99 | /// @todo to be 'print safe', should we encode as well character 127 (DEL) ? |
100 | 100 | |
101 | - for ($i = 160; $i < 256; $i++) { |
|
101 | + for ($i = 160; $i<256; $i++) { |
|
102 | 102 | $this->xml_iso88591_Entities["in"][] = chr($i); |
103 | 103 | $this->xml_iso88591_Entities["out"][] = "&#{$i};"; |
104 | 104 | } |
@@ -126,7 +126,7 @@ discard block |
||
126 | 126 | break;*/ |
127 | 127 | |
128 | 128 | default: |
129 | - throw new \Exception('Unsupported table: ' . $tableName); |
|
129 | + throw new \Exception('Unsupported table: '.$tableName); |
|
130 | 130 | } |
131 | 131 | } |
132 | 132 | |
@@ -178,7 +178,7 @@ discard block |
||
178 | 178 | $srcEncoding = 'UTF-8'; |
179 | 179 | } |
180 | 180 | |
181 | - $conversion = strtoupper($srcEncoding . '_' . $destEncoding); |
|
181 | + $conversion = strtoupper($srcEncoding.'_'.$destEncoding); |
|
182 | 182 | |
183 | 183 | // list ordered with (expected) most common scenarios first |
184 | 184 | switch ($conversion) { |
@@ -196,20 +196,20 @@ discard block |
||
196 | 196 | // NB: this will choke on invalid UTF-8, going most likely beyond EOF |
197 | 197 | $escapedData = ''; |
198 | 198 | // be kind to users creating string xml-rpc values out of different php types |
199 | - $data = (string)$data; |
|
199 | + $data = (string) $data; |
|
200 | 200 | $ns = strlen($data); |
201 | - for ($nn = 0; $nn < $ns; $nn++) { |
|
201 | + for ($nn = 0; $nn<$ns; $nn++) { |
|
202 | 202 | $ch = $data[$nn]; |
203 | 203 | $ii = ord($ch); |
204 | 204 | // 7 bits in 1 byte: 0bbbbbbb (127) |
205 | - if ($ii < 32) { |
|
205 | + if ($ii<32) { |
|
206 | 206 | if ($conversion == 'UTF-8_US-ASCII') { |
207 | 207 | $escapedData .= sprintf('&#%d;', $ii); |
208 | 208 | } else { |
209 | 209 | $escapedData .= $ch; |
210 | 210 | } |
211 | 211 | } |
212 | - else if ($ii < 128) { |
|
212 | + else if ($ii<128) { |
|
213 | 213 | /// @todo shall we replace this with a (supposedly) faster str_replace? |
214 | 214 | /// @todo to be 'print safe', should we encode as well character 127 (DEL) ? |
215 | 215 | switch ($ii) { |
@@ -234,25 +234,25 @@ discard block |
||
234 | 234 | } // 11 bits in 2 bytes: 110bbbbb 10bbbbbb (2047) |
235 | 235 | elseif ($ii >> 5 == 6) { |
236 | 236 | $b1 = ($ii & 31); |
237 | - $b2 = (ord($data[$nn + 1]) & 63); |
|
238 | - $ii = ($b1 * 64) + $b2; |
|
237 | + $b2 = (ord($data[$nn+1]) & 63); |
|
238 | + $ii = ($b1 * 64)+$b2; |
|
239 | 239 | $escapedData .= sprintf('&#%d;', $ii); |
240 | 240 | $nn += 1; |
241 | 241 | } // 16 bits in 3 bytes: 1110bbbb 10bbbbbb 10bbbbbb |
242 | 242 | elseif ($ii >> 4 == 14) { |
243 | 243 | $b1 = ($ii & 15); |
244 | - $b2 = (ord($data[$nn + 1]) & 63); |
|
245 | - $b3 = (ord($data[$nn + 2]) & 63); |
|
246 | - $ii = ((($b1 * 64) + $b2) * 64) + $b3; |
|
244 | + $b2 = (ord($data[$nn+1]) & 63); |
|
245 | + $b3 = (ord($data[$nn+2]) & 63); |
|
246 | + $ii = ((($b1 * 64)+$b2) * 64)+$b3; |
|
247 | 247 | $escapedData .= sprintf('&#%d;', $ii); |
248 | 248 | $nn += 2; |
249 | 249 | } // 21 bits in 4 bytes: 11110bbb 10bbbbbb 10bbbbbb 10bbbbbb |
250 | 250 | elseif ($ii >> 3 == 30) { |
251 | 251 | $b1 = ($ii & 7); |
252 | - $b2 = (ord($data[$nn + 1]) & 63); |
|
253 | - $b3 = (ord($data[$nn + 2]) & 63); |
|
254 | - $b4 = (ord($data[$nn + 3]) & 63); |
|
255 | - $ii = ((((($b1 * 64) + $b2) * 64) + $b3) * 64) + $b4; |
|
252 | + $b2 = (ord($data[$nn+1]) & 63); |
|
253 | + $b3 = (ord($data[$nn+2]) & 63); |
|
254 | + $b4 = (ord($data[$nn+3]) & 63); |
|
255 | + $ii = ((((($b1 * 64)+$b2) * 64)+$b3) * 64)+$b4; |
|
256 | 256 | $escapedData .= sprintf('&#%d;', $ii); |
257 | 257 | $nn += 3; |
258 | 258 | } |
@@ -305,7 +305,7 @@ discard block |
||
305 | 305 | // If src is UTF8, we run htmlspecialchars before converting to the target charset, as |
306 | 306 | // htmlspecialchars has limited charset support, but it groks utf8 |
307 | 307 | if ($srcEncoding === 'UTF-8') { |
308 | - $data = htmlspecialchars($data, defined('ENT_XML1') ? ENT_XML1 | ENT_QUOTES : ENT_QUOTES, 'UTF-8'); |
|
308 | + $data = htmlspecialchars($data, defined('ENT_XML1') ? ENT_XML1 | ENT_QUOTES : ENT_QUOTES, 'UTF-8'); |
|
309 | 309 | } |
310 | 310 | if ($srcEncoding !== $destEncoding) { |
311 | 311 | try { |
@@ -317,7 +317,7 @@ discard block |
||
317 | 317 | } |
318 | 318 | if ($data === false) { |
319 | 319 | $escapedData = ''; |
320 | - $this->getLogger()->errorLog('XML-RPC: ' . __METHOD__ . ": Converting from $srcEncoding to $destEncoding via mbstring: failed..."); |
|
320 | + $this->getLogger()->errorLog('XML-RPC: '.__METHOD__.": Converting from $srcEncoding to $destEncoding via mbstring: failed..."); |
|
321 | 321 | } else { |
322 | 322 | if ($srcEncoding === 'UTF-8') { |
323 | 323 | $escapedData = $data; |
@@ -327,7 +327,7 @@ discard block |
||
327 | 327 | } |
328 | 328 | } else { |
329 | 329 | $escapedData = ''; |
330 | - $this->getLogger()->errorLog('XML-RPC: ' . __METHOD__ . ": Converting from $srcEncoding to $destEncoding: not supported..."); |
|
330 | + $this->getLogger()->errorLog('XML-RPC: '.__METHOD__.": Converting from $srcEncoding to $destEncoding: not supported..."); |
|
331 | 331 | } |
332 | 332 | } |
333 | 333 | |
@@ -345,7 +345,7 @@ discard block |
||
345 | 345 | if (function_exists('mb_list_encodings')) { |
346 | 346 | $knownCharsets = array_unique(array_merge($knownCharsets, array_diff(mb_list_encodings(), array( |
347 | 347 | 'pass', 'auto', 'wchar', 'BASE64', 'UUENCODE', 'ASCII', 'HTML-ENTITIES', 'Quoted-Printable', |
348 | - '7bit','8bit', 'byte2be', 'byte2le', 'byte4be', 'byte4le' |
|
348 | + '7bit', '8bit', 'byte2be', 'byte2le', 'byte4be', 'byte4le' |
|
349 | 349 | )))); |
350 | 350 | } |
351 | 351 | return $knownCharsets; |
@@ -399,7 +399,7 @@ discard block |
||
399 | 399 | case 'iso88591': |
400 | 400 | return $this->xml_iso88591_Entities; |
401 | 401 | default: |
402 | - throw new \Exception('Unsupported charset: ' . $charset); |
|
402 | + throw new \Exception('Unsupported charset: '.$charset); |
|
403 | 403 | } |
404 | 404 | } |
405 | 405 | } |
@@ -191,12 +191,12 @@ discard block |
||
191 | 191 | foreach ($mergedOptions as $key => $val) { |
192 | 192 | // q: can php be built without ctype? should we use a regexp? |
193 | 193 | if (is_string($key) && !ctype_digit($key)) { |
194 | - switch($key) { |
|
194 | + switch ($key) { |
|
195 | 195 | case 'target_charset': |
196 | 196 | if (function_exists('mb_convert_encoding')) { |
197 | 197 | $this->current_parsing_options['target_charset'] = $val; |
198 | 198 | } else { |
199 | - $this->getLogger()->errorLog('XML-RPC: ' . __METHOD__ . ": 'target_charset' option is unsupported without mbstring"); |
|
199 | + $this->getLogger()->errorLog('XML-RPC: '.__METHOD__.": 'target_charset' option is unsupported without mbstring"); |
|
200 | 200 | } |
201 | 201 | break; |
202 | 202 | |
@@ -207,7 +207,7 @@ discard block |
||
207 | 207 | //$this->_xh['isf'] = 4; |
208 | 208 | //$this->_xh['isf_reason'] = "Callback passed as 'methodname_callback' is not callable"; |
209 | 209 | //return; |
210 | - $this->getLogger()->errorLog('XML-RPC: ' . __METHOD__ . ": Callback passed as 'methodname_callback' is not callable"); |
|
210 | + $this->getLogger()->errorLog('XML-RPC: '.__METHOD__.": Callback passed as 'methodname_callback' is not callable"); |
|
211 | 211 | } |
212 | 212 | break; |
213 | 213 | |
@@ -218,7 +218,7 @@ discard block |
||
218 | 218 | break; |
219 | 219 | |
220 | 220 | default: |
221 | - $this->getLogger()->errorLog('XML-RPC: ' . __METHOD__ . ": unsupported option: $key"); |
|
221 | + $this->getLogger()->errorLog('XML-RPC: '.__METHOD__.": unsupported option: $key"); |
|
222 | 222 | } |
223 | 223 | unset($mergedOptions[$key]); |
224 | 224 | } |
@@ -264,10 +264,10 @@ discard block |
||
264 | 264 | |
265 | 265 | try { |
266 | 266 | // @see ticket #70 - we have to parse big xml docs in chunks to avoid errors |
267 | - for ($offset = 0; $offset < $len; $offset += $this->maxChunkLength) { |
|
267 | + for ($offset = 0; $offset<$len; $offset += $this->maxChunkLength) { |
|
268 | 268 | $chunk = substr($data, $offset, $this->maxChunkLength); |
269 | 269 | // error handling: xml not well formed |
270 | - if (!xml_parse($parser, $chunk, $offset + $this->maxChunkLength >= $len)) { |
|
270 | + if (!xml_parse($parser, $chunk, $offset+$this->maxChunkLength>=$len)) { |
|
271 | 271 | $errCode = xml_get_error_code($parser); |
272 | 272 | $errStr = sprintf('XML error %s: %s at line %d, column %d', $errCode, xml_error_string($errCode), |
273 | 273 | xml_get_current_line_number($parser), xml_get_current_column_number($parser)); |
@@ -277,7 +277,7 @@ discard block |
||
277 | 277 | break; |
278 | 278 | } |
279 | 279 | // no need to parse further if we already have a fatal error |
280 | - if ($this->_xh['isf'] >= 2) { |
|
280 | + if ($this->_xh['isf']>=2) { |
|
281 | 281 | break; |
282 | 282 | } |
283 | 283 | } |
@@ -309,7 +309,7 @@ discard block |
||
309 | 309 | public function xmlrpc_se($parser, $name, $attrs, $acceptSingleVals = false) |
310 | 310 | { |
311 | 311 | // if invalid xml-rpc already detected, skip all processing |
312 | - if ($this->_xh['isf'] >= 2) { |
|
312 | + if ($this->_xh['isf']>=2) { |
|
313 | 313 | return; |
314 | 314 | } |
315 | 315 | |
@@ -332,7 +332,7 @@ discard block |
||
332 | 332 | $this->_xh['rt'] = strtolower($name); |
333 | 333 | } else { |
334 | 334 | $this->_xh['isf'] = 2; |
335 | - $this->_xh['isf_reason'] = 'missing top level xmlrpc element. Found: ' . $name; |
|
335 | + $this->_xh['isf_reason'] = 'missing top level xmlrpc element. Found: '.$name; |
|
336 | 336 | |
337 | 337 | return; |
338 | 338 | } |
@@ -434,7 +434,7 @@ discard block |
||
434 | 434 | |
435 | 435 | case 'MEMBER': |
436 | 436 | // set member name to null, in case we do not find in the xml later on |
437 | - $this->_xh['valuestack'][count($this->_xh['valuestack']) - 1]['name'] = null; |
|
437 | + $this->_xh['valuestack'][count($this->_xh['valuestack'])-1]['name'] = null; |
|
438 | 438 | //$this->_xh['ac']=''; |
439 | 439 | // Drop trough intentionally |
440 | 440 | |
@@ -508,7 +508,7 @@ discard block |
||
508 | 508 | */ |
509 | 509 | public function xmlrpc_ee($parser, $name, $rebuildXmlrpcvals = 1) |
510 | 510 | { |
511 | - if ($this->_xh['isf'] >= 2) { |
|
511 | + if ($this->_xh['isf']>=2) { |
|
512 | 512 | return; |
513 | 513 | |
514 | 514 | } |
@@ -530,7 +530,7 @@ discard block |
||
530 | 530 | $this->_xh['value'] = mb_convert_encoding($this->_xh['value'], $this->current_parsing_options['target_charset'], 'UTF-8'); |
531 | 531 | } |
532 | 532 | |
533 | - if ($rebuildXmlrpcvals > 0) { |
|
533 | + if ($rebuildXmlrpcvals>0) { |
|
534 | 534 | // build the xml-rpc val out of the data received, and substitute it |
535 | 535 | $temp = new Value($this->_xh['value'], $this->_xh['vt']); |
536 | 536 | // in case we got info about underlying php class, save it in the object we're rebuilding |
@@ -538,15 +538,15 @@ discard block |
||
538 | 538 | $temp->_php_class = $this->_xh['php_class']; |
539 | 539 | } |
540 | 540 | $this->_xh['value'] = $temp; |
541 | - } elseif ($rebuildXmlrpcvals < 0) { |
|
541 | + } elseif ($rebuildXmlrpcvals<0) { |
|
542 | 542 | if ($this->_xh['vt'] == Value::$xmlrpcDateTime) { |
543 | - $this->_xh['value'] = (object)array( |
|
543 | + $this->_xh['value'] = (object) array( |
|
544 | 544 | 'xmlrpc_type' => 'datetime', |
545 | 545 | 'scalar' => $this->_xh['value'], |
546 | 546 | 'timestamp' => \PhpXmlRpc\Helper\Date::iso8601Decode($this->_xh['value']) |
547 | 547 | ); |
548 | 548 | } elseif ($this->_xh['vt'] == Value::$xmlrpcBase64) { |
549 | - $this->_xh['value'] = (object)array( |
|
549 | + $this->_xh['value'] = (object) array( |
|
550 | 550 | 'xmlrpc_type' => 'base64', |
551 | 551 | 'scalar' => $this->_xh['value'] |
552 | 552 | ); |
@@ -561,8 +561,8 @@ discard block |
||
561 | 561 | // check if we are inside an array or struct: |
562 | 562 | // if value just built is inside an array, let's move it into array on the stack |
563 | 563 | $vscount = count($this->_xh['valuestack']); |
564 | - if ($vscount && $this->_xh['valuestack'][$vscount - 1]['type'] == 'ARRAY') { |
|
565 | - $this->_xh['valuestack'][$vscount - 1]['values'][] = $this->_xh['value']; |
|
564 | + if ($vscount && $this->_xh['valuestack'][$vscount-1]['type'] == 'ARRAY') { |
|
565 | + $this->_xh['valuestack'][$vscount-1]['values'][] = $this->_xh['value']; |
|
566 | 566 | } |
567 | 567 | break; |
568 | 568 | |
@@ -591,10 +591,10 @@ discard block |
||
591 | 591 | if ($this->_xh['ac'] != '0' && strcasecmp($this->_xh['ac'], 'false') !== 0) { |
592 | 592 | if ($this->current_parsing_options['xmlrpc_reject_invalid_values']) { |
593 | 593 | $this->_xh['isf'] = 2; |
594 | - $this->_xh['isf_reason'] = 'Invalid data received in BOOLEAN value: ' . $this->truncateForLog($this->_xh['ac']); |
|
594 | + $this->_xh['isf_reason'] = 'Invalid data received in BOOLEAN value: '.$this->truncateForLog($this->_xh['ac']); |
|
595 | 595 | return; |
596 | 596 | } else { |
597 | - $this->getLogger()->errorLog('XML-RPC: ' . __METHOD__ . ': invalid data received in BOOLEAN value: ' . |
|
597 | + $this->getLogger()->errorLog('XML-RPC: '.__METHOD__.': invalid data received in BOOLEAN value: '. |
|
598 | 598 | $this->truncateForLog($this->_xh['ac'])); |
599 | 599 | } |
600 | 600 | } |
@@ -616,17 +616,17 @@ discard block |
||
616 | 616 | if ($this->current_parsing_options['xmlrpc_reject_invalid_values']) |
617 | 617 | { |
618 | 618 | $this->_xh['isf'] = 2; |
619 | - $this->_xh['isf_reason'] = 'Non numeric data received in INT value: ' . $this->truncateForLog($this->_xh['ac']); |
|
619 | + $this->_xh['isf_reason'] = 'Non numeric data received in INT value: '.$this->truncateForLog($this->_xh['ac']); |
|
620 | 620 | return; |
621 | 621 | } else { |
622 | - $this->getLogger()->errorLog('XML-RPC: ' . __METHOD__ . ': non numeric data received in INT: ' . |
|
622 | + $this->getLogger()->errorLog('XML-RPC: '.__METHOD__.': non numeric data received in INT: '. |
|
623 | 623 | $this->truncateForLog($this->_xh['ac'])); |
624 | 624 | } |
625 | 625 | /// @todo: find a better way of reporting an error value than this! Use NaN? |
626 | 626 | $this->_xh['value'] = 'ERROR_NON_NUMERIC_FOUND'; |
627 | 627 | } else { |
628 | 628 | // it's ok, add it on |
629 | - $this->_xh['value'] = (int)$this->_xh['ac']; |
|
629 | + $this->_xh['value'] = (int) $this->_xh['ac']; |
|
630 | 630 | } |
631 | 631 | break; |
632 | 632 | |
@@ -636,18 +636,18 @@ discard block |
||
636 | 636 | if (!preg_match(PhpXmlRpc::$xmlrpc_double_format, $this->_xh['ac'])) { |
637 | 637 | if ($this->current_parsing_options['xmlrpc_reject_invalid_values']) { |
638 | 638 | $this->_xh['isf'] = 2; |
639 | - $this->_xh['isf_reason'] = 'Non numeric data received in DOUBLE value: ' . |
|
639 | + $this->_xh['isf_reason'] = 'Non numeric data received in DOUBLE value: '. |
|
640 | 640 | $this->truncateForLog($this->_xh['ac']); |
641 | 641 | return; |
642 | 642 | } else { |
643 | - $this->getLogger()->errorLog('XML-RPC: ' . __METHOD__ . ': non numeric data received in DOUBLE value: ' . |
|
643 | + $this->getLogger()->errorLog('XML-RPC: '.__METHOD__.': non numeric data received in DOUBLE value: '. |
|
644 | 644 | $this->truncateForLog($this->_xh['ac'])); |
645 | 645 | } |
646 | 646 | |
647 | 647 | $this->_xh['value'] = 'ERROR_NON_NUMERIC_FOUND'; |
648 | 648 | } else { |
649 | 649 | // it's ok, add it on |
650 | - $this->_xh['value'] = (double)$this->_xh['ac']; |
|
650 | + $this->_xh['value'] = (double) $this->_xh['ac']; |
|
651 | 651 | } |
652 | 652 | break; |
653 | 653 | |
@@ -657,19 +657,19 @@ discard block |
||
657 | 657 | if (!preg_match(PhpXmlRpc::$xmlrpc_datetime_format, $this->_xh['ac'])) { |
658 | 658 | if ($this->current_parsing_options['xmlrpc_reject_invalid_values']) { |
659 | 659 | $this->_xh['isf'] = 2; |
660 | - $this->_xh['isf_reason'] = 'Invalid data received in DATETIME value: ' . $this->truncateForLog($this->_xh['ac']); |
|
660 | + $this->_xh['isf_reason'] = 'Invalid data received in DATETIME value: '.$this->truncateForLog($this->_xh['ac']); |
|
661 | 661 | return; |
662 | 662 | } else { |
663 | - $this->getLogger()->errorLog('XML-RPC: ' . __METHOD__ . ': invalid data received in DATETIME value: ' . |
|
663 | + $this->getLogger()->errorLog('XML-RPC: '.__METHOD__.': invalid data received in DATETIME value: '. |
|
664 | 664 | $this->truncateForLog($this->_xh['ac'])); |
665 | 665 | } |
666 | 666 | } |
667 | 667 | if ($this->current_parsing_options['xmlrpc_return_datetimes']) { |
668 | 668 | try { |
669 | 669 | $this->_xh['value'] = new \DateTime($this->_xh['ac']); |
670 | - } catch(\Exception $e) { |
|
670 | + } catch (\Exception $e) { |
|
671 | 671 | // q: what to do? we can not guarantee that a valid date can be created. Return null or throw? |
672 | - $this->getLogger()->errorLog('XML-RPC: ' . __METHOD__ . ': ' . $e->getMessage()); |
|
672 | + $this->getLogger()->errorLog('XML-RPC: '.__METHOD__.': '.$e->getMessage()); |
|
673 | 673 | $this->_xh['value'] = null; |
674 | 674 | } |
675 | 675 | } else { |
@@ -684,14 +684,14 @@ discard block |
||
684 | 684 | $v = base64_decode($this->_xh['ac'], true); |
685 | 685 | if ($v === false) { |
686 | 686 | $this->_xh['isf'] = 2; |
687 | - $this->_xh['isf_reason'] = 'Invalid data received in BASE64 value: '. $this->truncateForLog($this->_xh['ac']); |
|
687 | + $this->_xh['isf_reason'] = 'Invalid data received in BASE64 value: '.$this->truncateForLog($this->_xh['ac']); |
|
688 | 688 | return; |
689 | 689 | } |
690 | 690 | } else { |
691 | 691 | $v = base64_decode($this->_xh['ac']); |
692 | 692 | if ($v === '' && $this->_xh['ac'] !== '') { |
693 | 693 | // only the empty string should decode to the empty string |
694 | - $this->getLogger()->errorLog('XML-RPC: ' . __METHOD__ . ': invalid data received in BASE64 value: ' . |
|
694 | + $this->getLogger()->errorLog('XML-RPC: '.__METHOD__.': invalid data received in BASE64 value: '. |
|
695 | 695 | $this->truncateForLog($this->_xh['ac'])); |
696 | 696 | } |
697 | 697 | } |
@@ -699,31 +699,31 @@ discard block |
||
699 | 699 | break; |
700 | 700 | |
701 | 701 | case 'NAME': |
702 | - $this->_xh['valuestack'][count($this->_xh['valuestack']) - 1]['name'] = $this->_xh['ac']; |
|
702 | + $this->_xh['valuestack'][count($this->_xh['valuestack'])-1]['name'] = $this->_xh['ac']; |
|
703 | 703 | break; |
704 | 704 | |
705 | 705 | case 'MEMBER': |
706 | 706 | // add to array in the stack the last element built, unless no VALUE or no NAME were found |
707 | 707 | if ($this->_xh['vt']) { |
708 | 708 | $vscount = count($this->_xh['valuestack']); |
709 | - if ($this->_xh['valuestack'][$vscount - 1]['name'] === null) { |
|
709 | + if ($this->_xh['valuestack'][$vscount-1]['name'] === null) { |
|
710 | 710 | if ($this->current_parsing_options['xmlrpc_reject_invalid_values']) { |
711 | 711 | $this->_xh['isf'] = 2; |
712 | 712 | $this->_xh['isf_reason'] = 'Missing NAME inside STRUCT in received xml'; |
713 | 713 | return; |
714 | 714 | } else { |
715 | - $this->getLogger()->errorLog('XML-RPC: ' . __METHOD__ . ': missing NAME inside STRUCT in received xml'); |
|
715 | + $this->getLogger()->errorLog('XML-RPC: '.__METHOD__.': missing NAME inside STRUCT in received xml'); |
|
716 | 716 | } |
717 | - $this->_xh['valuestack'][$vscount - 1]['name'] = ''; |
|
717 | + $this->_xh['valuestack'][$vscount-1]['name'] = ''; |
|
718 | 718 | } |
719 | - $this->_xh['valuestack'][$vscount - 1]['values'][$this->_xh['valuestack'][$vscount - 1]['name']] = $this->_xh['value']; |
|
719 | + $this->_xh['valuestack'][$vscount-1]['values'][$this->_xh['valuestack'][$vscount-1]['name']] = $this->_xh['value']; |
|
720 | 720 | } else { |
721 | 721 | if ($this->current_parsing_options['xmlrpc_reject_invalid_values']) { |
722 | 722 | $this->_xh['isf'] = 2; |
723 | 723 | $this->_xh['isf_reason'] = 'Missing VALUE inside STRUCT in received xml'; |
724 | 724 | return; |
725 | 725 | } else { |
726 | - $this->getLogger()->errorLog('XML-RPC: ' . __METHOD__ . ': missing VALUE inside STRUCT in received xml'); |
|
726 | + $this->getLogger()->errorLog('XML-RPC: '.__METHOD__.': missing VALUE inside STRUCT in received xml'); |
|
727 | 727 | } |
728 | 728 | } |
729 | 729 | break; |
@@ -754,7 +754,7 @@ discard block |
||
754 | 754 | $this->_xh['isf_reason'] = 'Missing VALUE inside PARAM in received xml'; |
755 | 755 | return; |
756 | 756 | } else { |
757 | - $this->getLogger()->errorLog('XML-RPC: ' . __METHOD__ . ': missing VALUE inside PARAM in received xml'); |
|
757 | + $this->getLogger()->errorLog('XML-RPC: '.__METHOD__.': missing VALUE inside PARAM in received xml'); |
|
758 | 758 | } |
759 | 759 | } |
760 | 760 | break; |
@@ -763,10 +763,10 @@ discard block |
||
763 | 763 | if (!preg_match(PhpXmlRpc::$xmlrpc_methodname_format, $this->_xh['ac'])) { |
764 | 764 | if ($this->current_parsing_options['xmlrpc_reject_invalid_values']) { |
765 | 765 | $this->_xh['isf'] = 2; |
766 | - $this->_xh['isf_reason'] = 'Invalid data received in METHODNAME: '. $this->truncateForLog($this->_xh['ac']); |
|
766 | + $this->_xh['isf_reason'] = 'Invalid data received in METHODNAME: '.$this->truncateForLog($this->_xh['ac']); |
|
767 | 767 | return; |
768 | 768 | } else { |
769 | - $this->getLogger()->errorLog('XML-RPC: ' . __METHOD__ . ': invalid data received in METHODNAME: '. |
|
769 | + $this->getLogger()->errorLog('XML-RPC: '.__METHOD__.': invalid data received in METHODNAME: '. |
|
770 | 770 | $this->truncateForLog($this->_xh['ac'])); |
771 | 771 | } |
772 | 772 | } |
@@ -839,7 +839,7 @@ discard block |
||
839 | 839 | public function xmlrpc_cd($parser, $data) |
840 | 840 | { |
841 | 841 | // skip processing if xml fault already detected |
842 | - if ($this->_xh['isf'] >= 2) { |
|
842 | + if ($this->_xh['isf']>=2) { |
|
843 | 843 | return; |
844 | 844 | } |
845 | 845 | |
@@ -861,7 +861,7 @@ discard block |
||
861 | 861 | public function xmlrpc_dh($parser, $data) |
862 | 862 | { |
863 | 863 | // skip processing if xml fault already detected |
864 | - if ($this->_xh['isf'] >= 2) { |
|
864 | + if ($this->_xh['isf']>=2) { |
|
865 | 865 | return; |
866 | 866 | } |
867 | 867 | |
@@ -935,8 +935,8 @@ discard block |
||
935 | 935 | // Details: |
936 | 936 | // SPACE: (#x20 | #x9 | #xD | #xA)+ === [ \x9\xD\xA]+ |
937 | 937 | // EQ: SPACE?=SPACE? === [ \x9\xD\xA]*=[ \x9\xD\xA]* |
938 | - if (preg_match('/^<\?xml\s+version\s*=\s*' . "((?:\"[a-zA-Z0-9_.:-]+\")|(?:'[a-zA-Z0-9_.:-]+'))" . |
|
939 | - '\s+encoding\s*=\s*' . "((?:\"[A-Za-z][A-Za-z0-9._-]*\")|(?:'[A-Za-z][A-Za-z0-9._-]*'))/", |
|
938 | + if (preg_match('/^<\?xml\s+version\s*=\s*'."((?:\"[a-zA-Z0-9_.:-]+\")|(?:'[a-zA-Z0-9_.:-]+'))". |
|
939 | + '\s+encoding\s*=\s*'."((?:\"[A-Za-z][A-Za-z0-9._-]*\")|(?:'[A-Za-z][A-Za-z0-9._-]*'))/", |
|
940 | 940 | $xmlChunk, $matches)) { |
941 | 941 | return strtoupper(substr($matches[2], 1, -1)); |
942 | 942 | } |
@@ -954,7 +954,7 @@ discard block |
||
954 | 954 | // NB: mb_detect likes to call it ascii, xml parser likes to call it US_ASCII... |
955 | 955 | // IANA also likes better US-ASCII, so go with it |
956 | 956 | if ($enc == 'ASCII') { |
957 | - $enc = 'US-' . $enc; |
|
957 | + $enc = 'US-'.$enc; |
|
958 | 958 | } |
959 | 959 | |
960 | 960 | return $enc; |
@@ -991,8 +991,8 @@ discard block |
||
991 | 991 | // Details: |
992 | 992 | // SPACE: (#x20 | #x9 | #xD | #xA)+ === [ \x9\xD\xA]+ |
993 | 993 | // EQ: SPACE?=SPACE? === [ \x9\xD\xA]*=[ \x9\xD\xA]* |
994 | - if (preg_match('/^<\?xml\s+version\s*=\s*' . "((?:\"[a-zA-Z0-9_.:-]+\")|(?:'[a-zA-Z0-9_.:-]+'))" . |
|
995 | - '\s+encoding\s*=\s*' . "((?:\"[A-Za-z][A-Za-z0-9._-]*\")|(?:'[A-Za-z][A-Za-z0-9._-]*'))/", |
|
994 | + if (preg_match('/^<\?xml\s+version\s*=\s*'."((?:\"[a-zA-Z0-9_.:-]+\")|(?:'[a-zA-Z0-9_.:-]+'))". |
|
995 | + '\s+encoding\s*=\s*'."((?:\"[A-Za-z][A-Za-z0-9._-]*\")|(?:'[A-Za-z][A-Za-z0-9._-]*'))/", |
|
996 | 996 | $xmlChunk)) { |
997 | 997 | return true; |
998 | 998 | } |
@@ -1012,7 +1012,7 @@ discard block |
||
1012 | 1012 | break; |
1013 | 1013 | default: |
1014 | 1014 | $trace = debug_backtrace(DEBUG_BACKTRACE_IGNORE_ARGS); |
1015 | - trigger_error('Undefined property via __set(): ' . $name . ' in ' . $trace[0]['file'] . ' on line ' . $trace[0]['line'], E_USER_WARNING); |
|
1015 | + trigger_error('Undefined property via __set(): '.$name.' in '.$trace[0]['file'].' on line '.$trace[0]['line'], E_USER_WARNING); |
|
1016 | 1016 | } |
1017 | 1017 | } |
1018 | 1018 | |
@@ -1036,7 +1036,7 @@ discard block |
||
1036 | 1036 | break; |
1037 | 1037 | default: |
1038 | 1038 | $trace = debug_backtrace(DEBUG_BACKTRACE_IGNORE_ARGS); |
1039 | - trigger_error('Undefined property via __unset(): ' . $name . ' in ' . $trace[0]['file'] . ' on line ' . $trace[0]['line'], E_USER_WARNING); |
|
1039 | + trigger_error('Undefined property via __unset(): '.$name.' in '.$trace[0]['file'].' on line '.$trace[0]['line'], E_USER_WARNING); |
|
1040 | 1040 | } |
1041 | 1041 | } |
1042 | 1042 | |
@@ -1047,8 +1047,8 @@ discard block |
||
1047 | 1047 | */ |
1048 | 1048 | protected function truncateForLog($data) |
1049 | 1049 | { |
1050 | - if (strlen($data) > $this->maxLogValueLength) { |
|
1051 | - return substr($data, 0, $this->maxLogValueLength - 3) . '...'; |
|
1050 | + if (strlen($data)>$this->maxLogValueLength) { |
|
1051 | + return substr($data, 0, $this->maxLogValueLength-3).'...'; |
|
1052 | 1052 | } |
1053 | 1053 | |
1054 | 1054 | return $data; |
@@ -24,7 +24,7 @@ discard block |
||
24 | 24 | } |
25 | 25 | } |
26 | 26 | |
27 | -require_once __DIR__ . "/_prepend.php"; |
|
27 | +require_once __DIR__."/_prepend.php"; |
|
28 | 28 | |
29 | 29 | use PhpXmlRpc\PhpXmlRpc; |
30 | 30 | use PhpXmlRpc\Server; |
@@ -83,7 +83,7 @@ discard block |
||
83 | 83 | } elseif ($_GET['FORCE_AUTH'] == 'Digest') { |
84 | 84 | if (empty($_SERVER['PHP_AUTH_DIGEST'])) { |
85 | 85 | header('HTTP/1.1 401 Unauthorized'); |
86 | - header('WWW-Authenticate: Digest realm="Phpxmlrpc Digest Realm",qop="auth",nonce="' . uniqid() . '",opaque="' . md5('Phpxmlrpc Digest Realm') . '"'); |
|
86 | + header('WWW-Authenticate: Digest realm="Phpxmlrpc Digest Realm",qop="auth",nonce="'.uniqid().'",opaque="'.md5('Phpxmlrpc Digest Realm').'"'); |
|
87 | 87 | die('Text visible if user hits Cancel button'); |
88 | 88 | } |
89 | 89 | } |
@@ -91,7 +91,7 @@ discard block |
||
91 | 91 | if (isset($_GET['FORCE_REDIRECT'])) { |
92 | 92 | header('HTTP/1.0 302 Found'); |
93 | 93 | unset($_GET['FORCE_REDIRECT']); |
94 | - header('Location: ' . $_SERVER['REQUEST_URI'] . (count($_GET) ? '?' . http_build_query($_GET) : '')); |
|
94 | + header('Location: '.$_SERVER['REQUEST_URI'].(count($_GET) ? '?'.http_build_query($_GET) : '')); |
|
95 | 95 | die(); |
96 | 96 | } |
97 | 97 | } |
@@ -293,10 +293,10 @@ discard block |
||
293 | 293 | $server = $parts['host']; |
294 | 294 | $path = isset($parts['path']) ? $parts['path'] : ''; |
295 | 295 | if (isset($parts['query'])) { |
296 | - $path .= '?' . $parts['query']; |
|
296 | + $path .= '?'.$parts['query']; |
|
297 | 297 | } |
298 | 298 | if (isset($parts['fragment'])) { |
299 | - $path .= '#' . $parts['fragment']; |
|
299 | + $path .= '#'.$parts['fragment']; |
|
300 | 300 | } |
301 | 301 | if (isset($parts['port'])) { |
302 | 302 | $port = $parts['port']; |
@@ -312,7 +312,7 @@ discard block |
||
312 | 312 | } |
313 | 313 | } |
314 | 314 | if ($path == '' || $path[0] != '/') { |
315 | - $this->path = '/' . $path; |
|
315 | + $this->path = '/'.$path; |
|
316 | 316 | } else { |
317 | 317 | $this->path = $path; |
318 | 318 | } |
@@ -344,7 +344,7 @@ discard block |
||
344 | 344 | //$this->accepted_charset_encodings = $ch->knownCharsets(); |
345 | 345 | |
346 | 346 | // initialize user_agent string |
347 | - $this->user_agent = PhpXmlRpc::$xmlrpcName . ' ' . PhpXmlRpc::$xmlrpcVersion; |
|
347 | + $this->user_agent = PhpXmlRpc::$xmlrpcName.' '.PhpXmlRpc::$xmlrpcVersion; |
|
348 | 348 | } |
349 | 349 | |
350 | 350 | /** |
@@ -770,7 +770,7 @@ discard block |
||
770 | 770 | */ |
771 | 771 | protected function sendPayloadHTTP10($req, $server, $port, $timeout = 0, $username = '', $password = '', |
772 | 772 | $authType = 1, $proxyHost = '', $proxyPort = 0, $proxyUsername = '', $proxyPassword = '', $proxyAuthType = 1, |
773 | - $method='http') |
|
773 | + $method = 'http') |
|
774 | 774 | { |
775 | 775 | //trigger_error('Method ' . __METHOD__ . ' is deprecated', E_USER_DEPRECATED); |
776 | 776 | |
@@ -803,7 +803,7 @@ discard block |
||
803 | 803 | * @param int $sslVersion |
804 | 804 | * @return Response |
805 | 805 | */ |
806 | - protected function sendPayloadHTTPS($req, $server, $port, $timeout = 0, $username = '', $password = '', |
|
806 | + protected function sendPayloadHTTPS($req, $server, $port, $timeout = 0, $username = '', $password = '', |
|
807 | 807 | $authType = 1, $cert = '', $certPass = '', $caCert = '', $caCertDir = '', $proxyHost = '', $proxyPort = 0, |
808 | 808 | $proxyUsername = '', $proxyPassword = '', $proxyAuthType = 1, $keepAlive = false, $key = '', $keyPass = '', |
809 | 809 | $sslVersion = 0) |
@@ -842,7 +842,7 @@ discard block |
||
842 | 842 | */ |
843 | 843 | protected function sendPayloadSocket($req, $server, $port, $timeout = 0, $username = '', $password = '', |
844 | 844 | $authType = 1, $cert = '', $certPass = '', $caCert = '', $caCertDir = '', $proxyHost = '', $proxyPort = 0, |
845 | - $proxyUsername = '', $proxyPassword = '', $proxyAuthType = 1, $method='http', $key = '', $keyPass = '', |
|
845 | + $proxyUsername = '', $proxyPassword = '', $proxyAuthType = 1, $method = 'http', $key = '', $keyPass = '', |
|
846 | 846 | $sslVersion = 0) |
847 | 847 | { |
848 | 848 | /// @todo log a warning if passed an unsupported method |
@@ -879,16 +879,16 @@ discard block |
||
879 | 879 | // thanks to Grant Rauscher <[email protected]> for this |
880 | 880 | $credentials = ''; |
881 | 881 | if ($username != '') { |
882 | - $credentials = 'Authorization: Basic ' . base64_encode($username . ':' . $password) . "\r\n"; |
|
882 | + $credentials = 'Authorization: Basic '.base64_encode($username.':'.$password)."\r\n"; |
|
883 | 883 | if ($authType != 1) { |
884 | 884 | /// @todo make this a proper error, i.e. return a failure |
885 | - $this->getLogger()->errorLog('XML-RPC: ' . __METHOD__ . ': warning. Only Basic auth is supported with HTTP 1.0'); |
|
885 | + $this->getLogger()->errorLog('XML-RPC: '.__METHOD__.': warning. Only Basic auth is supported with HTTP 1.0'); |
|
886 | 886 | } |
887 | 887 | } |
888 | 888 | |
889 | 889 | $acceptedEncoding = ''; |
890 | 890 | if (is_array($this->accepted_compression) && count($this->accepted_compression)) { |
891 | - $acceptedEncoding = 'Accept-Encoding: ' . implode(', ', $this->accepted_compression) . "\r\n"; |
|
891 | + $acceptedEncoding = 'Accept-Encoding: '.implode(', ', $this->accepted_compression)."\r\n"; |
|
892 | 892 | } |
893 | 893 | |
894 | 894 | $proxyCredentials = ''; |
@@ -900,13 +900,13 @@ discard block |
||
900 | 900 | $connectPort = $proxyPort; |
901 | 901 | $transport = 'tcp'; |
902 | 902 | /// @todo check: should we not use https in some cases? |
903 | - $uri = 'http://' . $server . ':' . $port . $this->path; |
|
903 | + $uri = 'http://'.$server.':'.$port.$this->path; |
|
904 | 904 | if ($proxyUsername != '') { |
905 | 905 | if ($proxyAuthType != 1) { |
906 | 906 | /// @todo make this a proper error, i.e. return a failure |
907 | - $this->getLogger()->errorLog('XML-RPC: ' . __METHOD__ . ': warning. Only Basic auth to proxy is supported with HTTP 1.0'); |
|
907 | + $this->getLogger()->errorLog('XML-RPC: '.__METHOD__.': warning. Only Basic auth to proxy is supported with HTTP 1.0'); |
|
908 | 908 | } |
909 | - $proxyCredentials = 'Proxy-Authorization: Basic ' . base64_encode($proxyUsername . ':' . $proxyPassword) . "\r\n"; |
|
909 | + $proxyCredentials = 'Proxy-Authorization: Basic '.base64_encode($proxyUsername.':'.$proxyPassword)."\r\n"; |
|
910 | 910 | } |
911 | 911 | } else { |
912 | 912 | $connectServer = $server; |
@@ -921,45 +921,45 @@ discard block |
||
921 | 921 | $version = ''; |
922 | 922 | foreach ($this->cookies as $name => $cookie) { |
923 | 923 | if ($cookie['version']) { |
924 | - $version = ' $Version="' . $cookie['version'] . '";'; |
|
925 | - $cookieHeader .= ' ' . $name . '="' . $cookie['value'] . '";'; |
|
924 | + $version = ' $Version="'.$cookie['version'].'";'; |
|
925 | + $cookieHeader .= ' '.$name.'="'.$cookie['value'].'";'; |
|
926 | 926 | if ($cookie['path']) { |
927 | - $cookieHeader .= ' $Path="' . $cookie['path'] . '";'; |
|
927 | + $cookieHeader .= ' $Path="'.$cookie['path'].'";'; |
|
928 | 928 | } |
929 | 929 | if ($cookie['domain']) { |
930 | - $cookieHeader .= ' $Domain="' . $cookie['domain'] . '";'; |
|
930 | + $cookieHeader .= ' $Domain="'.$cookie['domain'].'";'; |
|
931 | 931 | } |
932 | 932 | if ($cookie['port']) { |
933 | - $cookieHeader .= ' $Port="' . $cookie['port'] . '";'; |
|
933 | + $cookieHeader .= ' $Port="'.$cookie['port'].'";'; |
|
934 | 934 | } |
935 | 935 | } else { |
936 | - $cookieHeader .= ' ' . $name . '=' . $cookie['value'] . ";"; |
|
936 | + $cookieHeader .= ' '.$name.'='.$cookie['value'].";"; |
|
937 | 937 | } |
938 | 938 | } |
939 | - $cookieHeader = 'Cookie:' . $version . substr($cookieHeader, 0, -1) . "\r\n"; |
|
939 | + $cookieHeader = 'Cookie:'.$version.substr($cookieHeader, 0, -1)."\r\n"; |
|
940 | 940 | } |
941 | 941 | |
942 | 942 | // omit port if default |
943 | 943 | if (($port == 80 && in_array($method, array('http', 'http10'))) || ($port == 443 && $method == 'https')) { |
944 | - $port = ''; |
|
944 | + $port = ''; |
|
945 | 945 | } else { |
946 | - $port = ':' . $port; |
|
946 | + $port = ':'.$port; |
|
947 | 947 | } |
948 | 948 | |
949 | - $op = 'POST ' . $uri . " HTTP/1.0\r\n" . |
|
950 | - 'User-Agent: ' . $this->user_agent . "\r\n" . |
|
951 | - 'Host: ' . $server . $port . "\r\n" . |
|
952 | - $credentials . |
|
953 | - $proxyCredentials . |
|
954 | - $acceptedEncoding . |
|
955 | - $encodingHdr . |
|
956 | - 'Accept-Charset: ' . implode(',', $this->accepted_charset_encodings) . "\r\n" . |
|
957 | - $cookieHeader . |
|
958 | - 'Content-Type: ' . $req->content_type . "\r\nContent-Length: " . |
|
959 | - strlen($payload) . "\r\n\r\n" . |
|
949 | + $op = 'POST '.$uri." HTTP/1.0\r\n". |
|
950 | + 'User-Agent: '.$this->user_agent."\r\n". |
|
951 | + 'Host: '.$server.$port."\r\n". |
|
952 | + $credentials. |
|
953 | + $proxyCredentials. |
|
954 | + $acceptedEncoding. |
|
955 | + $encodingHdr. |
|
956 | + 'Accept-Charset: '.implode(',', $this->accepted_charset_encodings)."\r\n". |
|
957 | + $cookieHeader. |
|
958 | + 'Content-Type: '.$req->content_type."\r\nContent-Length: ". |
|
959 | + strlen($payload)."\r\n\r\n". |
|
960 | 960 | $payload; |
961 | 961 | |
962 | - if ($this->debug > 1) { |
|
962 | + if ($this->debug>1) { |
|
963 | 963 | $this->getLogger()->debugMessage("---SENDING---\n$op\n---END---"); |
964 | 964 | } |
965 | 965 | |
@@ -986,7 +986,7 @@ discard block |
||
986 | 986 | |
987 | 987 | $context = stream_context_create($contextOptions); |
988 | 988 | |
989 | - if ($timeout <= 0) { |
|
989 | + if ($timeout<=0) { |
|
990 | 990 | $connectTimeout = ini_get('default_socket_timeout'); |
991 | 991 | } else { |
992 | 992 | $connectTimeout = $timeout; |
@@ -998,7 +998,7 @@ discard block |
||
998 | 998 | $fp = @stream_socket_client("$transport://$connectServer:$connectPort", $this->errno, $this->errstr, $connectTimeout, |
999 | 999 | STREAM_CLIENT_CONNECT, $context); |
1000 | 1000 | if ($fp) { |
1001 | - if ($timeout > 0) { |
|
1001 | + if ($timeout>0) { |
|
1002 | 1002 | stream_set_timeout($fp, $timeout, 0); |
1003 | 1003 | } |
1004 | 1004 | } else { |
@@ -1007,8 +1007,8 @@ discard block |
||
1007 | 1007 | $this->errstr = $err['message']; |
1008 | 1008 | } |
1009 | 1009 | |
1010 | - $this->errstr = 'Connect error: ' . $this->errstr; |
|
1011 | - $r = new static::$responseClass(0, PhpXmlRpc::$xmlrpcerr['http_error'], $this->errstr . ' (' . $this->errno . ')'); |
|
1010 | + $this->errstr = 'Connect error: '.$this->errstr; |
|
1011 | + $r = new static::$responseClass(0, PhpXmlRpc::$xmlrpcerr['http_error'], $this->errstr.' ('.$this->errno.')'); |
|
1012 | 1012 | |
1013 | 1013 | return $r; |
1014 | 1014 | } |
@@ -1096,18 +1096,18 @@ discard block |
||
1096 | 1096 | $keyPass, $sslVersion); |
1097 | 1097 | |
1098 | 1098 | if (!$curl) { |
1099 | - return new static::$responseClass(0, PhpXmlRpc::$xmlrpcerr['curl_fail'], PhpXmlRpc::$xmlrpcstr['curl_fail'] . ': error during curl initialization. Check php error log for details'); |
|
1099 | + return new static::$responseClass(0, PhpXmlRpc::$xmlrpcerr['curl_fail'], PhpXmlRpc::$xmlrpcstr['curl_fail'].': error during curl initialization. Check php error log for details'); |
|
1100 | 1100 | } |
1101 | 1101 | |
1102 | 1102 | $result = curl_exec($curl); |
1103 | 1103 | |
1104 | - if ($this->debug > 1) { |
|
1104 | + if ($this->debug>1) { |
|
1105 | 1105 | $message = "---CURL INFO---\n"; |
1106 | 1106 | foreach (curl_getinfo($curl) as $name => $val) { |
1107 | 1107 | if (is_array($val)) { |
1108 | 1108 | $val = implode("\n", $val); |
1109 | 1109 | } |
1110 | - $message .= $name . ': ' . $val . "\n"; |
|
1110 | + $message .= $name.': '.$val."\n"; |
|
1111 | 1111 | } |
1112 | 1112 | $message .= '---END---'; |
1113 | 1113 | $this->getLogger()->debugMessage($message); |
@@ -1117,7 +1117,7 @@ discard block |
||
1117 | 1117 | /// @todo we should use a better check here - what if we get back '' or '0'? |
1118 | 1118 | |
1119 | 1119 | $this->errstr = 'no response'; |
1120 | - $resp = new static::$responseClass(0, PhpXmlRpc::$xmlrpcerr['curl_fail'], PhpXmlRpc::$xmlrpcstr['curl_fail'] . ': ' . curl_error($curl)); |
|
1120 | + $resp = new static::$responseClass(0, PhpXmlRpc::$xmlrpcerr['curl_fail'], PhpXmlRpc::$xmlrpcstr['curl_fail'].': '.curl_error($curl)); |
|
1121 | 1121 | curl_close($curl); |
1122 | 1122 | if ($keepAlive) { |
1123 | 1123 | $this->xmlrpc_curl_handle = null; |
@@ -1187,12 +1187,12 @@ discard block |
||
1187 | 1187 | // http, https |
1188 | 1188 | $protocol = $method; |
1189 | 1189 | if (strpos($protocol, ':') !== false) { |
1190 | - $this->getLogger()->errorLog('XML-RPC: ' . __METHOD__ . ": warning - attempted hacking attempt?. The curl protocol requested for the call is: '$protocol'"); |
|
1190 | + $this->getLogger()->errorLog('XML-RPC: '.__METHOD__.": warning - attempted hacking attempt?. The curl protocol requested for the call is: '$protocol'"); |
|
1191 | 1191 | return false; |
1192 | 1192 | } |
1193 | 1193 | } |
1194 | 1194 | } |
1195 | - $curl = curl_init($protocol . '://' . $server . ':' . $port . $this->path); |
|
1195 | + $curl = curl_init($protocol.'://'.$server.':'.$port.$this->path); |
|
1196 | 1196 | if (!$curl) { |
1197 | 1197 | return false; |
1198 | 1198 | } |
@@ -1206,7 +1206,7 @@ discard block |
||
1206 | 1206 | // results into variable |
1207 | 1207 | curl_setopt($curl, CURLOPT_RETURNTRANSFER, true); |
1208 | 1208 | |
1209 | - if ($this->debug > 1) { |
|
1209 | + if ($this->debug>1) { |
|
1210 | 1210 | curl_setopt($curl, CURLOPT_VERBOSE, true); |
1211 | 1211 | /// @todo redirect curlopt_stderr to some stream which can be piped to the logger |
1212 | 1212 | } |
@@ -1231,7 +1231,7 @@ discard block |
||
1231 | 1231 | } |
1232 | 1232 | } |
1233 | 1233 | // extra headers |
1234 | - $headers = array('Content-Type: ' . $req->content_type, 'Accept-Charset: ' . implode(',', $this->accepted_charset_encodings)); |
|
1234 | + $headers = array('Content-Type: '.$req->content_type, 'Accept-Charset: '.implode(',', $this->accepted_charset_encodings)); |
|
1235 | 1235 | // if no keepalive is wanted, let the server know it in advance |
1236 | 1236 | if (!$keepAlive) { |
1237 | 1237 | $headers[] = 'Connection: close'; |
@@ -1248,7 +1248,7 @@ discard block |
||
1248 | 1248 | curl_setopt($curl, CURLOPT_HTTPHEADER, $headers); |
1249 | 1249 | // timeout is borked |
1250 | 1250 | if ($timeout) { |
1251 | - curl_setopt($curl, CURLOPT_TIMEOUT, $timeout == 1 ? 1 : $timeout - 1); |
|
1251 | + curl_setopt($curl, CURLOPT_TIMEOUT, $timeout == 1 ? 1 : $timeout-1); |
|
1252 | 1252 | } |
1253 | 1253 | |
1254 | 1254 | switch ($method) { |
@@ -1263,7 +1263,7 @@ discard block |
||
1263 | 1263 | curl_setopt($curl, CURLOPT_HTTP_VERSION, CURL_HTTP_VERSION_2_PRIOR_KNOWLEDGE); |
1264 | 1264 | } else { |
1265 | 1265 | /// @todo make this a proper error, i.e. return a failure |
1266 | - $this->getLogger()->errorLog('XML-RPC: ' . __METHOD__ . ': warning. HTTP2 is not supported by the current PHP/curl install'); |
|
1266 | + $this->getLogger()->errorLog('XML-RPC: '.__METHOD__.': warning. HTTP2 is not supported by the current PHP/curl install'); |
|
1267 | 1267 | } |
1268 | 1268 | break; |
1269 | 1269 | case 'h2': |
@@ -1272,12 +1272,12 @@ discard block |
||
1272 | 1272 | } |
1273 | 1273 | |
1274 | 1274 | if ($username && $password) { |
1275 | - curl_setopt($curl, CURLOPT_USERPWD, $username . ':' . $password); |
|
1275 | + curl_setopt($curl, CURLOPT_USERPWD, $username.':'.$password); |
|
1276 | 1276 | if (defined('CURLOPT_HTTPAUTH')) { |
1277 | 1277 | curl_setopt($curl, CURLOPT_HTTPAUTH, $authType); |
1278 | 1278 | } elseif ($authType != 1) { |
1279 | 1279 | /// @todo make this a proper error, i.e. return a failure |
1280 | - $this->getLogger()->errorLog('XML-RPC: ' . __METHOD__ . ': warning. Only Basic auth is supported by the current PHP/curl install'); |
|
1280 | + $this->getLogger()->errorLog('XML-RPC: '.__METHOD__.': warning. Only Basic auth is supported by the current PHP/curl install'); |
|
1281 | 1281 | } |
1282 | 1282 | } |
1283 | 1283 | |
@@ -1320,14 +1320,14 @@ discard block |
||
1320 | 1320 | if ($proxyPort == 0) { |
1321 | 1321 | $proxyPort = 8080; // NB: even for HTTPS, local connection is on port 8080 |
1322 | 1322 | } |
1323 | - curl_setopt($curl, CURLOPT_PROXY, $proxyHost . ':' . $proxyPort); |
|
1323 | + curl_setopt($curl, CURLOPT_PROXY, $proxyHost.':'.$proxyPort); |
|
1324 | 1324 | if ($proxyUsername) { |
1325 | - curl_setopt($curl, CURLOPT_PROXYUSERPWD, $proxyUsername . ':' . $proxyPassword); |
|
1325 | + curl_setopt($curl, CURLOPT_PROXYUSERPWD, $proxyUsername.':'.$proxyPassword); |
|
1326 | 1326 | if (defined('CURLOPT_PROXYAUTH')) { |
1327 | 1327 | curl_setopt($curl, CURLOPT_PROXYAUTH, $proxyAuthType); |
1328 | 1328 | } elseif ($proxyAuthType != 1) { |
1329 | 1329 | /// @todo make this a proper error, i.e. return a failure |
1330 | - $this->getLogger()->errorLog('XML-RPC: ' . __METHOD__ . ': warning. Only Basic auth to proxy is supported by the current PHP/curl install'); |
|
1330 | + $this->getLogger()->errorLog('XML-RPC: '.__METHOD__.': warning. Only Basic auth to proxy is supported by the current PHP/curl install'); |
|
1331 | 1331 | } |
1332 | 1332 | } |
1333 | 1333 | } |
@@ -1337,7 +1337,7 @@ discard block |
||
1337 | 1337 | if (count($this->cookies)) { |
1338 | 1338 | $cookieHeader = ''; |
1339 | 1339 | foreach ($this->cookies as $name => $cookie) { |
1340 | - $cookieHeader .= $name . '=' . $cookie['value'] . '; '; |
|
1340 | + $cookieHeader .= $name.'='.$cookie['value'].'; '; |
|
1341 | 1341 | } |
1342 | 1342 | curl_setopt($curl, CURLOPT_COOKIE, substr($cookieHeader, 0, -2)); |
1343 | 1343 | } |
@@ -1346,7 +1346,7 @@ discard block |
||
1346 | 1346 | curl_setopt($curl, $opt, $val); |
1347 | 1347 | } |
1348 | 1348 | |
1349 | - if ($this->debug > 1) { |
|
1349 | + if ($this->debug>1) { |
|
1350 | 1350 | $this->getLogger()->debugMessage("---SENDING---\n$payload\n---END---"); |
1351 | 1351 | } |
1352 | 1352 | |
@@ -1437,7 +1437,7 @@ discard block |
||
1437 | 1437 | $call['methodName'] = new Value($req->method(), 'string'); |
1438 | 1438 | $numParams = $req->getNumParams(); |
1439 | 1439 | $params = array(); |
1440 | - for ($i = 0; $i < $numParams; $i++) { |
|
1440 | + for ($i = 0; $i<$numParams; $i++) { |
|
1441 | 1441 | $params[$i] = $req->getParam($i); |
1442 | 1442 | } |
1443 | 1443 | $call['params'] = new Value($params, 'array'); |
@@ -1459,7 +1459,7 @@ discard block |
||
1459 | 1459 | $response = array(); |
1460 | 1460 | |
1461 | 1461 | if ($this->return_type == 'xml') { |
1462 | - for ($i = 0; $i < count($reqs); $i++) { |
|
1462 | + for ($i = 0; $i<count($reqs); $i++) { |
|
1463 | 1463 | $response[] = new Response($rets, 0, '', 'xml', $result->httpResponse()); |
1464 | 1464 | } |
1465 | 1465 | |
@@ -1467,21 +1467,21 @@ discard block |
||
1467 | 1467 | if (!is_array($rets)) { |
1468 | 1468 | // bad return type from system.multicall |
1469 | 1469 | return new Response(0, PhpXmlRpc::$xmlrpcerr['multicall_error'], |
1470 | - PhpXmlRpc::$xmlrpcstr['multicall_error'] . ': not an array', 'phpvals', $result->httpResponse()); |
|
1470 | + PhpXmlRpc::$xmlrpcstr['multicall_error'].': not an array', 'phpvals', $result->httpResponse()); |
|
1471 | 1471 | } |
1472 | 1472 | $numRets = count($rets); |
1473 | 1473 | if ($numRets != count($reqs)) { |
1474 | 1474 | // wrong number of return values. |
1475 | 1475 | return new Response(0, PhpXmlRpc::$xmlrpcerr['multicall_error'], |
1476 | - PhpXmlRpc::$xmlrpcstr['multicall_error'] . ': incorrect number of responses', 'phpvals', |
|
1476 | + PhpXmlRpc::$xmlrpcstr['multicall_error'].': incorrect number of responses', 'phpvals', |
|
1477 | 1477 | $result->httpResponse()); |
1478 | 1478 | } |
1479 | 1479 | |
1480 | - for ($i = 0; $i < $numRets; $i++) { |
|
1480 | + for ($i = 0; $i<$numRets; $i++) { |
|
1481 | 1481 | $val = $rets[$i]; |
1482 | 1482 | if (!is_array($val)) { |
1483 | 1483 | return new Response(0, PhpXmlRpc::$xmlrpcerr['multicall_error'], |
1484 | - PhpXmlRpc::$xmlrpcstr['multicall_error'] . ": response element $i is not an array or struct", |
|
1484 | + PhpXmlRpc::$xmlrpcstr['multicall_error'].": response element $i is not an array or struct", |
|
1485 | 1485 | 'phpvals', $result->httpResponse()); |
1486 | 1486 | } |
1487 | 1487 | switch (count($val)) { |
@@ -1489,7 +1489,7 @@ discard block |
||
1489 | 1489 | if (!isset($val[0])) { |
1490 | 1490 | // Bad value |
1491 | 1491 | return new Response(0, PhpXmlRpc::$xmlrpcerr['multicall_error'], |
1492 | - PhpXmlRpc::$xmlrpcstr['multicall_error'] . ": response element $i has no value", |
|
1492 | + PhpXmlRpc::$xmlrpcstr['multicall_error'].": response element $i has no value", |
|
1493 | 1493 | 'phpvals', $result->httpResponse()); |
1494 | 1494 | } |
1495 | 1495 | // Normal return value |
@@ -1501,20 +1501,20 @@ discard block |
||
1501 | 1501 | if (!is_int($code)) { |
1502 | 1502 | /// @todo should we check that it is != 0? |
1503 | 1503 | return new Response(0, PhpXmlRpc::$xmlrpcerr['multicall_error'], |
1504 | - PhpXmlRpc::$xmlrpcstr['multicall_error'] . ": response element $i has invalid or no faultCode", |
|
1504 | + PhpXmlRpc::$xmlrpcstr['multicall_error'].": response element $i has invalid or no faultCode", |
|
1505 | 1505 | 'phpvals', $result->httpResponse()); |
1506 | 1506 | } |
1507 | 1507 | $str = @$val['faultString']; |
1508 | 1508 | if (!is_string($str)) { |
1509 | 1509 | return new Response(0, PhpXmlRpc::$xmlrpcerr['multicall_error'], |
1510 | - PhpXmlRpc::$xmlrpcstr['multicall_error'] . ": response element $i has invalid or no FaultString", |
|
1510 | + PhpXmlRpc::$xmlrpcstr['multicall_error'].": response element $i has invalid or no FaultString", |
|
1511 | 1511 | 'phpvals', $result->httpResponse()); |
1512 | 1512 | } |
1513 | 1513 | $response[$i] = new Response(0, $code, $str, 'phpvals', $result->httpResponse()); |
1514 | 1514 | break; |
1515 | 1515 | default: |
1516 | 1516 | return new Response(0, PhpXmlRpc::$xmlrpcerr['multicall_error'], |
1517 | - PhpXmlRpc::$xmlrpcstr['multicall_error'] . ": response element $i has too many items", |
|
1517 | + PhpXmlRpc::$xmlrpcstr['multicall_error'].": response element $i has too many items", |
|
1518 | 1518 | 'phpvals', $result->httpResponse()); |
1519 | 1519 | } |
1520 | 1520 | } |
@@ -1523,14 +1523,14 @@ discard block |
||
1523 | 1523 | // return type == 'xmlrpcvals' |
1524 | 1524 | if ($rets->kindOf() != 'array') { |
1525 | 1525 | return new Response(0, PhpXmlRpc::$xmlrpcerr['multicall_error'], |
1526 | - PhpXmlRpc::$xmlrpcstr['multicall_error'] . ": response element $i is not an array", 'xmlrpcvals', |
|
1526 | + PhpXmlRpc::$xmlrpcstr['multicall_error'].": response element $i is not an array", 'xmlrpcvals', |
|
1527 | 1527 | $result->httpResponse()); |
1528 | 1528 | } |
1529 | 1529 | $numRets = $rets->count(); |
1530 | 1530 | if ($numRets != count($reqs)) { |
1531 | 1531 | // wrong number of return values. |
1532 | 1532 | return new Response(0, PhpXmlRpc::$xmlrpcerr['multicall_error'], |
1533 | - PhpXmlRpc::$xmlrpcstr['multicall_error'] . ': incorrect number of responses', 'xmlrpcvals', |
|
1533 | + PhpXmlRpc::$xmlrpcstr['multicall_error'].': incorrect number of responses', 'xmlrpcvals', |
|
1534 | 1534 | $result->httpResponse()); |
1535 | 1535 | } |
1536 | 1536 | |
@@ -1539,7 +1539,7 @@ discard block |
||
1539 | 1539 | case 'array': |
1540 | 1540 | if ($val->count() != 1) { |
1541 | 1541 | return new Response(0, PhpXmlRpc::$xmlrpcerr['multicall_error'], |
1542 | - PhpXmlRpc::$xmlrpcstr['multicall_error'] . ": response element $i has too many items", |
|
1542 | + PhpXmlRpc::$xmlrpcstr['multicall_error'].": response element $i has too many items", |
|
1543 | 1543 | 'phpvals', $result->httpResponse()); |
1544 | 1544 | } |
1545 | 1545 | // Normal return value |
@@ -1548,28 +1548,28 @@ discard block |
||
1548 | 1548 | case 'struct': |
1549 | 1549 | if ($val->count() != 2) { |
1550 | 1550 | return new Response(0, PhpXmlRpc::$xmlrpcerr['multicall_error'], |
1551 | - PhpXmlRpc::$xmlrpcstr['multicall_error'] . ": response element $i has too many items", |
|
1551 | + PhpXmlRpc::$xmlrpcstr['multicall_error'].": response element $i has too many items", |
|
1552 | 1552 | 'phpvals', $result->httpResponse()); |
1553 | 1553 | } |
1554 | 1554 | /** @var Value $code */ |
1555 | 1555 | $code = $val['faultCode']; |
1556 | 1556 | if ($code->kindOf() != 'scalar' || $code->scalartyp() != 'int') { |
1557 | 1557 | return new Response(0, PhpXmlRpc::$xmlrpcerr['multicall_error'], |
1558 | - PhpXmlRpc::$xmlrpcstr['multicall_error'] . ": response element $i has invalid or no faultCode", |
|
1558 | + PhpXmlRpc::$xmlrpcstr['multicall_error'].": response element $i has invalid or no faultCode", |
|
1559 | 1559 | 'xmlrpcvals', $result->httpResponse()); |
1560 | 1560 | } |
1561 | 1561 | /** @var Value $str */ |
1562 | 1562 | $str = $val['faultString']; |
1563 | 1563 | if ($str->kindOf() != 'scalar' || $str->scalartyp() != 'string') { |
1564 | 1564 | return new Response(0, PhpXmlRpc::$xmlrpcerr['multicall_error'], |
1565 | - PhpXmlRpc::$xmlrpcstr['multicall_error'] . ": response element $i has invalid or no faultCode", |
|
1565 | + PhpXmlRpc::$xmlrpcstr['multicall_error'].": response element $i has invalid or no faultCode", |
|
1566 | 1566 | 'xmlrpcvals', $result->httpResponse()); |
1567 | 1567 | } |
1568 | 1568 | $response[] = new Response(0, $code->scalarval(), $str->scalarval(), 'xmlrpcvals', $result->httpResponse()); |
1569 | 1569 | break; |
1570 | 1570 | default: |
1571 | 1571 | return new Response(0, PhpXmlRpc::$xmlrpcerr['multicall_error'], |
1572 | - PhpXmlRpc::$xmlrpcstr['multicall_error'] . ": response element $i is not an array or struct", |
|
1572 | + PhpXmlRpc::$xmlrpcstr['multicall_error'].": response element $i is not an array or struct", |
|
1573 | 1573 | 'xmlrpcvals', $result->httpResponse()); |
1574 | 1574 | } |
1575 | 1575 | } |
@@ -109,9 +109,9 @@ discard block |
||
109 | 109 | public function xml_header($charsetEncoding = '') |
110 | 110 | { |
111 | 111 | if ($charsetEncoding != '') { |
112 | - return "<?xml version=\"1.0\" encoding=\"$charsetEncoding\" ?" . ">\n<methodCall>\n"; |
|
112 | + return "<?xml version=\"1.0\" encoding=\"$charsetEncoding\" ?".">\n<methodCall>\n"; |
|
113 | 113 | } else { |
114 | - return "<?xml version=\"1.0\"?" . ">\n<methodCall>\n"; |
|
114 | + return "<?xml version=\"1.0\"?".">\n<methodCall>\n"; |
|
115 | 115 | } |
116 | 116 | } |
117 | 117 | |
@@ -134,16 +134,16 @@ discard block |
||
134 | 134 | public function createPayload($charsetEncoding = '') |
135 | 135 | { |
136 | 136 | if ($charsetEncoding != '') { |
137 | - $this->content_type = 'text/xml; charset=' . $charsetEncoding; |
|
137 | + $this->content_type = 'text/xml; charset='.$charsetEncoding; |
|
138 | 138 | } else { |
139 | 139 | $this->content_type = 'text/xml'; |
140 | 140 | } |
141 | 141 | $this->payload = $this->xml_header($charsetEncoding); |
142 | - $this->payload .= '<methodName>' . $this->getCharsetEncoder()->encodeEntities( |
|
143 | - $this->methodname, PhpXmlRpc::$xmlrpc_internalencoding, $charsetEncoding) . "</methodName>\n"; |
|
142 | + $this->payload .= '<methodName>'.$this->getCharsetEncoder()->encodeEntities( |
|
143 | + $this->methodname, PhpXmlRpc::$xmlrpc_internalencoding, $charsetEncoding)."</methodName>\n"; |
|
144 | 144 | $this->payload .= "<params>\n"; |
145 | 145 | foreach ($this->params as $p) { |
146 | - $this->payload .= "<param>\n" . $p->serialize($charsetEncoding) . |
|
146 | + $this->payload .= "<param>\n".$p->serialize($charsetEncoding). |
|
147 | 147 | "</param>\n"; |
148 | 148 | } |
149 | 149 | $this->payload .= "</params>\n"; |
@@ -258,7 +258,7 @@ discard block |
||
258 | 258 | */ |
259 | 259 | public function parseResponse($data = '', $headersProcessed = false, $returnType = XMLParser::RETURN_XMLRPCVALS) |
260 | 260 | { |
261 | - if ($this->debug > 0) { |
|
261 | + if ($this->debug>0) { |
|
262 | 262 | $this->getLogger()->debugMessage("---GOT---\n$data\n---END---"); |
263 | 263 | } |
264 | 264 | |
@@ -266,7 +266,7 @@ discard block |
||
266 | 266 | $this->httpResponse = $httpResponse; |
267 | 267 | |
268 | 268 | if ($data == '') { |
269 | - $this->getLogger()->errorLog('XML-RPC: ' . __METHOD__ . ': no response received from server.'); |
|
269 | + $this->getLogger()->errorLog('XML-RPC: '.__METHOD__.': no response received from server.'); |
|
270 | 270 | return new Response(0, PhpXmlRpc::$xmlrpcerr['no_data'], PhpXmlRpc::$xmlrpcstr['no_data']); |
271 | 271 | } |
272 | 272 | |
@@ -274,12 +274,12 @@ discard block |
||
274 | 274 | if (substr($data, 0, 4) == 'HTTP') { |
275 | 275 | $httpParser = new Http(); |
276 | 276 | try { |
277 | - $httpResponse = $httpParser->parseResponseHeaders($data, $headersProcessed, $this->debug > 0); |
|
277 | + $httpResponse = $httpParser->parseResponseHeaders($data, $headersProcessed, $this->debug>0); |
|
278 | 278 | } catch (HttpException $e) { |
279 | 279 | // failed processing of HTTP response headers |
280 | 280 | // save into response obj the full payload received, for debugging |
281 | 281 | return new Response(0, $e->getCode(), $e->getMessage(), '', array('raw_data' => $data, 'status_code', $e->statusCode())); |
282 | - } catch(\Exception $e) { |
|
282 | + } catch (\Exception $e) { |
|
283 | 283 | return new Response(0, $e->getCode(), $e->getMessage(), '', array('raw_data' => $data)); |
284 | 284 | } |
285 | 285 | } |
@@ -293,7 +293,7 @@ discard block |
||
293 | 293 | // idea from Luca Mariano <[email protected]> originally in PEARified version of the lib |
294 | 294 | $pos = strrpos($data, '</methodResponse>'); |
295 | 295 | if ($pos !== false) { |
296 | - $data = substr($data, 0, $pos + 17); |
|
296 | + $data = substr($data, 0, $pos+17); |
|
297 | 297 | } |
298 | 298 | |
299 | 299 | // try to 'guestimate' the character encoding of the received response |
@@ -302,20 +302,20 @@ discard block |
||
302 | 302 | $data |
303 | 303 | ); |
304 | 304 | |
305 | - if ($this->debug >= 0) { |
|
305 | + if ($this->debug>=0) { |
|
306 | 306 | $this->httpResponse = $httpResponse; |
307 | 307 | } else { |
308 | 308 | $httpResponse = null; |
309 | 309 | } |
310 | 310 | |
311 | - if ($this->debug > 0) { |
|
311 | + if ($this->debug>0) { |
|
312 | 312 | $start = strpos($data, '<!-- SERVER DEBUG INFO (BASE64 ENCODED):'); |
313 | 313 | if ($start) { |
314 | 314 | $start += strlen('<!-- SERVER DEBUG INFO (BASE64 ENCODED):'); |
315 | 315 | $end = strpos($data, '-->', $start); |
316 | - $comments = substr($data, $start, $end - $start); |
|
317 | - $this->getLogger()->debugMessage("---SERVER DEBUG INFO (DECODED) ---\n\t" . |
|
318 | - str_replace("\n", "\n\t", base64_decode($comments)) . "\n---END---", $respEncoding); |
|
316 | + $comments = substr($data, $start, $end-$start); |
|
317 | + $this->getLogger()->debugMessage("---SERVER DEBUG INFO (DECODED) ---\n\t". |
|
318 | + str_replace("\n", "\n\t", base64_decode($comments))."\n---END---", $respEncoding); |
|
319 | 319 | } |
320 | 320 | } |
321 | 321 | |
@@ -337,7 +337,7 @@ discard block |
||
337 | 337 | if ($respEncoding == 'ISO-8859-1') { |
338 | 338 | $data = utf8_encode($data); |
339 | 339 | } else { |
340 | - $this->getLogger()->errorLog('XML-RPC: ' . __METHOD__ . ': unsupported charset encoding of received response: ' . $respEncoding); |
|
340 | + $this->getLogger()->errorLog('XML-RPC: '.__METHOD__.': unsupported charset encoding of received response: '.$respEncoding); |
|
341 | 341 | } |
342 | 342 | } |
343 | 343 | } |
@@ -363,18 +363,18 @@ discard block |
||
363 | 363 | // there could be proxies meddling with the request, or network data corruption... |
364 | 364 | |
365 | 365 | $r = new Response(0, PhpXmlRpc::$xmlrpcerr['invalid_xml'], |
366 | - PhpXmlRpc::$xmlrpcstr['invalid_xml'] . ' ' . $xmlRpcParser->_xh['isf_reason'], '', |
|
366 | + PhpXmlRpc::$xmlrpcstr['invalid_xml'].' '.$xmlRpcParser->_xh['isf_reason'], '', |
|
367 | 367 | $httpResponse |
368 | 368 | ); |
369 | 369 | |
370 | - if ($this->debug > 0) { |
|
370 | + if ($this->debug>0) { |
|
371 | 371 | $this->getLogger()->debugMessage($xmlRpcParser->_xh['isf_reason']); |
372 | 372 | } |
373 | 373 | } |
374 | 374 | // second error check: xml well-formed but not xml-rpc compliant |
375 | 375 | elseif ($xmlRpcParser->_xh['isf'] == 2) { |
376 | 376 | $r = new Response(0, PhpXmlRpc::$xmlrpcerr['xml_not_compliant'], |
377 | - PhpXmlRpc::$xmlrpcstr['xml_not_compliant'] . ' ' . $xmlRpcParser->_xh['isf_reason'], '', |
|
377 | + PhpXmlRpc::$xmlrpcstr['xml_not_compliant'].' '.$xmlRpcParser->_xh['isf_reason'], '', |
|
378 | 378 | $httpResponse |
379 | 379 | ); |
380 | 380 | |
@@ -385,7 +385,7 @@ discard block |
||
385 | 385 | } |
386 | 386 | // third error check: parsing of the response has somehow gone boink. |
387 | 387 | /// @todo shall we omit this check, since we trust the parsing code? |
388 | - elseif ($xmlRpcParser->_xh['isf'] > 3 || $returnType == XMLParser::RETURN_XMLRPCVALS && !is_object($xmlRpcParser->_xh['value'])) { |
|
388 | + elseif ($xmlRpcParser->_xh['isf']>3 || $returnType == XMLParser::RETURN_XMLRPCVALS && !is_object($xmlRpcParser->_xh['value'])) { |
|
389 | 389 | // something odd has happened and it's time to generate a client side error indicating something odd went on |
390 | 390 | $r = new Response(0, PhpXmlRpc::$xmlrpcerr['xml_parsing_error'], PhpXmlRpc::$xmlrpcstr['xml_parsing_error'], |
391 | 391 | '', $httpResponse |
@@ -393,7 +393,7 @@ discard block |
||
393 | 393 | |
394 | 394 | /// @todo echo something for the user? |
395 | 395 | } else { |
396 | - if ($this->debug > 1) { |
|
396 | + if ($this->debug>1) { |
|
397 | 397 | $this->getLogger()->debugMessage( |
398 | 398 | "---PARSED---\n".var_export($xmlRpcParser->_xh['value'], true)."\n---END---" |
399 | 399 | ); |
@@ -1,6 +1,6 @@ discard block |
||
1 | 1 | <?php |
2 | 2 | |
3 | -include_once __DIR__ . '/PolyfillTestCase.php'; |
|
3 | +include_once __DIR__.'/PolyfillTestCase.php'; |
|
4 | 4 | |
5 | 5 | use PhpXmlRpc\Helper\Charset; |
6 | 6 | use PhpXmlRpc\Helper\Http; |
@@ -38,9 +38,9 @@ discard block |
||
38 | 38 | $l = $h->getLogger(); |
39 | 39 | Http::setLogger($this); |
40 | 40 | |
41 | - $s = "HTTP/1.0 200 OK\r\n" . |
|
42 | - "Content-Type: unknown\r\n" . |
|
43 | - "\r\n" . |
|
41 | + $s = "HTTP/1.0 200 OK\r\n". |
|
42 | + "Content-Type: unknown\r\n". |
|
43 | + "\r\n". |
|
44 | 44 | "body"; |
45 | 45 | ob_start(); |
46 | 46 | $h->parseResponseHeaders($s, false, 1); |
@@ -1,5 +1,5 @@ discard block |
||
1 | 1 | <?php |
2 | -require_once __DIR__ . "/_prepend.php"; |
|
2 | +require_once __DIR__."/_prepend.php"; |
|
3 | 3 | |
4 | 4 | /** |
5 | 5 | * Demoing how to inject a custom logger for use by the library |
@@ -22,13 +22,13 @@ discard block |
||
22 | 22 | // logger API |
23 | 23 | public function debugMessage($message, $encoding = null) |
24 | 24 | { |
25 | - $this->debugBuffer .= $message . "\n"; |
|
25 | + $this->debugBuffer .= $message."\n"; |
|
26 | 26 | } |
27 | 27 | |
28 | 28 | // logger API |
29 | 29 | public function errorLog($message) |
30 | 30 | { |
31 | - $this->errorBuffer .= $message . "\n"; |
|
31 | + $this->errorBuffer .= $message."\n"; |
|
32 | 32 | } |
33 | 33 | |
34 | 34 | public function getDebug() |
@@ -59,8 +59,8 @@ discard block |
||
59 | 59 | |
60 | 60 | $input = array( |
61 | 61 | array('name' => 'Dave', 'age' => 24), |
62 | - array('name' => 'Edd', 'age' => 45), |
|
63 | - array('name' => 'Joe', 'age' => 37), |
|
62 | + array('name' => 'Edd', 'age' => 45), |
|
63 | + array('name' => 'Joe', 'age' => 37), |
|
64 | 64 | array('name' => 'Fred', 'age' => 27), |
65 | 65 | ); |
66 | 66 | |
@@ -79,5 +79,5 @@ discard block |
||
79 | 79 | $response = $client->send($request); |
80 | 80 | output("Response received.<br>"); |
81 | 81 | |
82 | -output("The client error info is:<pre>\n" . $logger->getError() . "\n</pre>"); |
|
83 | -output("The client debug info is:<pre>\n" . $logger->getDebug() . "\n</pre>"); |
|
82 | +output("The client error info is:<pre>\n".$logger->getError()."\n</pre>"); |
|
83 | +output("The client debug info is:<pre>\n".$logger->getDebug()."\n</pre>"); |
@@ -8,7 +8,7 @@ discard block |
||
8 | 8 | } |
9 | 9 | |
10 | 10 | // Use the custom class autoloader. These two lines are not needed when the phpxmlrpc library is installed using Composer |
11 | -include_once __DIR__ . '/../../src/Autoloader.php'; |
|
11 | +include_once __DIR__.'/../../src/Autoloader.php'; |
|
12 | 12 | PhpXmlRpc\Autoloader::register(); |
13 | 13 | |
14 | 14 | // Let unit tests run against localhost, 'plain' demos against a known public server |
@@ -22,5 +22,5 @@ discard block |
||
22 | 22 | function output($text) |
23 | 23 | { |
24 | 24 | /// @todo we should only strip html tags, and let through all xml tags |
25 | - echo PHP_SAPI == 'cli' ? strip_tags(str_replace(array('<br/>','<br>'), "\n", $text)) : $text; |
|
25 | + echo PHP_SAPI == 'cli' ? strip_tags(str_replace(array('<br/>', '<br>'), "\n", $text)) : $text; |
|
26 | 26 | } |