@@ -194,7 +194,7 @@ discard block |
||
194 | 194 | */ |
195 | 195 | public static function xmlrpc_debugmsg($msg) |
196 | 196 | { |
197 | - static::$_xmlrpc_debuginfo .= $msg . "\n"; |
|
197 | + static::$_xmlrpc_debuginfo .= $msg."\n"; |
|
198 | 198 | } |
199 | 199 | |
200 | 200 | /** |
@@ -206,7 +206,7 @@ discard block |
||
206 | 206 | */ |
207 | 207 | public static function error_occurred($msg) |
208 | 208 | { |
209 | - static::$_xmlrpcs_occurred_errors .= $msg . "\n"; |
|
209 | + static::$_xmlrpcs_occurred_errors .= $msg."\n"; |
|
210 | 210 | } |
211 | 211 | |
212 | 212 | /** |
@@ -227,10 +227,10 @@ discard block |
||
227 | 227 | // user debug info should be encoded by the end user using the INTERNAL_ENCODING |
228 | 228 | $out = ''; |
229 | 229 | if ($this->debug_info != '') { |
230 | - $out .= "<!-- SERVER DEBUG INFO (BASE64 ENCODED):\n" . base64_encode($this->debug_info) . "\n-->\n"; |
|
230 | + $out .= "<!-- SERVER DEBUG INFO (BASE64 ENCODED):\n".base64_encode($this->debug_info)."\n-->\n"; |
|
231 | 231 | } |
232 | 232 | if (static::$_xmlrpc_debuginfo != '') { |
233 | - $out .= "<!-- DEBUG INFO:\n" . $this->getCharsetEncoder()->encodeEntities(str_replace('--', '_-', static::$_xmlrpc_debuginfo), PhpXmlRpc::$xmlrpc_internalencoding, $charsetEncoding) . "\n-->\n"; |
|
233 | + $out .= "<!-- DEBUG INFO:\n".$this->getCharsetEncoder()->encodeEntities(str_replace('--', '_-', static::$_xmlrpc_debuginfo), PhpXmlRpc::$xmlrpc_internalencoding, $charsetEncoding)."\n-->\n"; |
|
234 | 234 | // NB: a better solution MIGHT be to use CDATA, but we need to insert it |
235 | 235 | // into return payload AFTER the beginning tag |
236 | 236 | //$out .= "<![CDATA[ DEBUG INFO:\n\n" . str_replace(']]>', ']_]_>', static::$_xmlrpc_debuginfo) . "\n]]>\n"; |
@@ -259,8 +259,8 @@ discard block |
||
259 | 259 | $this->debug_info = ''; |
260 | 260 | |
261 | 261 | // Save what we received, before parsing it |
262 | - if ($this->debug > 1) { |
|
263 | - $this->debugmsg("+++GOT+++\n" . $data . "\n+++END+++"); |
|
262 | + if ($this->debug>1) { |
|
263 | + $this->debugmsg("+++GOT+++\n".$data."\n+++END+++"); |
|
264 | 264 | } |
265 | 265 | |
266 | 266 | $resp = $this->parseRequestHeaders($data, $reqCharset, $respCharset, $respEncoding); |
@@ -277,14 +277,14 @@ discard block |
||
277 | 277 | $resp->raw_data = $rawData; |
278 | 278 | } |
279 | 279 | |
280 | - if ($this->debug > 2 && static::$_xmlrpcs_occurred_errors != '') { |
|
281 | - $this->debugmsg("+++PROCESSING ERRORS AND WARNINGS+++\n" . |
|
282 | - static::$_xmlrpcs_occurred_errors . "+++END+++"); |
|
280 | + if ($this->debug>2 && static::$_xmlrpcs_occurred_errors != '') { |
|
281 | + $this->debugmsg("+++PROCESSING ERRORS AND WARNINGS+++\n". |
|
282 | + static::$_xmlrpcs_occurred_errors."+++END+++"); |
|
283 | 283 | } |
284 | 284 | |
285 | 285 | $payload = $this->xml_header($respCharset); |
286 | - if ($this->debug > 0) { |
|
287 | - $payload = $payload . $this->serializeDebug($respCharset); |
|
286 | + if ($this->debug>0) { |
|
287 | + $payload = $payload.$this->serializeDebug($respCharset); |
|
288 | 288 | } |
289 | 289 | |
290 | 290 | // Do not create response serialization if it has already happened. Helps to build json magic |
@@ -292,7 +292,7 @@ discard block |
||
292 | 292 | if (empty($resp->payload)) { |
293 | 293 | $resp->serialize($respCharset); |
294 | 294 | } |
295 | - $payload = $payload . $resp->payload; |
|
295 | + $payload = $payload.$resp->payload; |
|
296 | 296 | |
297 | 297 | if ($returnPayload) { |
298 | 298 | return $payload; |
@@ -301,7 +301,7 @@ discard block |
||
301 | 301 | // if we get a warning/error that has output some text before here, then we cannot |
302 | 302 | // add a new header. We cannot say we are sending xml, either... |
303 | 303 | if (!headers_sent()) { |
304 | - header('Content-Type: ' . $resp->content_type); |
|
304 | + header('Content-Type: '.$resp->content_type); |
|
305 | 305 | // we do not know if client actually told us an accepted charset, but if it did we have to tell it what we did |
306 | 306 | header("Vary: Accept-Charset"); |
307 | 307 | |
@@ -324,10 +324,10 @@ discard block |
||
324 | 324 | // Note that Apache/mod_php will add (and even alter!) the Content-Length header on its own, but only for |
325 | 325 | // responses up to 8000 bytes |
326 | 326 | if ($phpNoSelfCompress) { |
327 | - header('Content-Length: ' . (int)strlen($payload)); |
|
327 | + header('Content-Length: '.(int) strlen($payload)); |
|
328 | 328 | } |
329 | 329 | } else { |
330 | - $this->getLogger()->error('XML-RPC: ' . __METHOD__ . ': http headers already sent before response is fully generated. Check for php warning or error messages'); |
|
330 | + $this->getLogger()->error('XML-RPC: '.__METHOD__.': http headers already sent before response is fully generated. Check for php warning or error messages'); |
|
331 | 331 | } |
332 | 332 | |
333 | 333 | print $payload; |
@@ -390,9 +390,9 @@ discard block |
||
390 | 390 | $numParams = count($in); |
391 | 391 | } |
392 | 392 | foreach ($sigs as $curSig) { |
393 | - if (count($curSig) == $numParams + 1) { |
|
393 | + if (count($curSig) == $numParams+1) { |
|
394 | 394 | $itsOK = 1; |
395 | - for ($n = 0; $n < $numParams; $n++) { |
|
395 | + for ($n = 0; $n<$numParams; $n++) { |
|
396 | 396 | if (is_object($in)) { |
397 | 397 | $p = $in->getParam($n); |
398 | 398 | if ($p->kindOf() == 'scalar') { |
@@ -405,10 +405,10 @@ discard block |
||
405 | 405 | } |
406 | 406 | |
407 | 407 | // param index is $n+1, as first member of sig is return type |
408 | - if ($pt != $curSig[$n + 1] && $curSig[$n + 1] != Value::$xmlrpcValue) { |
|
408 | + if ($pt != $curSig[$n+1] && $curSig[$n+1] != Value::$xmlrpcValue) { |
|
409 | 409 | $itsOK = 0; |
410 | - $pno = $n + 1; |
|
411 | - $wanted = $curSig[$n + 1]; |
|
410 | + $pno = $n+1; |
|
411 | + $wanted = $curSig[$n+1]; |
|
412 | 412 | $got = $pt; |
413 | 413 | break; |
414 | 414 | } |
@@ -435,10 +435,10 @@ discard block |
||
435 | 435 | // check if $_SERVER is populated: it might have been disabled via ini file |
436 | 436 | // (this is true even when in CLI mode) |
437 | 437 | if (count($_SERVER) == 0) { |
438 | - $this->getLogger()->error('XML-RPC: ' . __METHOD__ . ': cannot parse request headers as $_SERVER is not populated'); |
|
438 | + $this->getLogger()->error('XML-RPC: '.__METHOD__.': cannot parse request headers as $_SERVER is not populated'); |
|
439 | 439 | } |
440 | 440 | |
441 | - if ($this->debug > 1) { |
|
441 | + if ($this->debug>1) { |
|
442 | 442 | if (function_exists('getallheaders')) { |
443 | 443 | $this->debugmsg(''); // empty line |
444 | 444 | foreach (getallheaders() as $name => $val) { |
@@ -463,13 +463,13 @@ discard block |
||
463 | 463 | if (function_exists('gzinflate') && in_array($contentEncoding, $this->accepted_compression)) { |
464 | 464 | if ($contentEncoding == 'deflate' && $degzdata = @gzuncompress($data)) { |
465 | 465 | $data = $degzdata; |
466 | - if ($this->debug > 1) { |
|
467 | - $this->debugmsg("\n+++INFLATED REQUEST+++[" . strlen($data) . " chars]+++\n" . $data . "\n+++END+++"); |
|
466 | + if ($this->debug>1) { |
|
467 | + $this->debugmsg("\n+++INFLATED REQUEST+++[".strlen($data)." chars]+++\n".$data."\n+++END+++"); |
|
468 | 468 | } |
469 | 469 | } elseif ($contentEncoding == 'gzip' && $degzdata = @gzinflate(substr($data, 10))) { |
470 | 470 | $data = $degzdata; |
471 | - if ($this->debug > 1) { |
|
472 | - $this->debugmsg("+++INFLATED REQUEST+++[" . strlen($data) . " chars]+++\n" . $data . "\n+++END+++"); |
|
471 | + if ($this->debug>1) { |
|
472 | + $this->debugmsg("+++INFLATED REQUEST+++[".strlen($data)." chars]+++\n".$data."\n+++END+++"); |
|
473 | 473 | } |
474 | 474 | } else { |
475 | 475 | $r = new Response(0, PhpXmlRpc::$xmlrpcerr['server_decompress_fail'], |
@@ -553,7 +553,7 @@ discard block |
||
553 | 553 | if (function_exists('mb_convert_encoding')) { |
554 | 554 | $data = mb_convert_encoding($data, 'UTF-8', $reqEncoding); |
555 | 555 | } else { |
556 | - $this->getLogger()->error('XML-RPC: ' . __METHOD__ . ': unsupported charset encoding of received request: ' . $reqEncoding); |
|
556 | + $this->getLogger()->error('XML-RPC: '.__METHOD__.': unsupported charset encoding of received request: '.$reqEncoding); |
|
557 | 557 | } |
558 | 558 | } |
559 | 559 | } |
@@ -579,7 +579,7 @@ discard block |
||
579 | 579 | preg_match('/^XML error ([0-9]+)/', $xmlRpcParser->_xh['isf_reason'], $matches); |
580 | 580 | return new Response( |
581 | 581 | 0, |
582 | - PhpXmlRpc::$xmlrpcerrxml + (int)$matches[1], |
|
582 | + PhpXmlRpc::$xmlrpcerrxml+(int) $matches[1], |
|
583 | 583 | $xmlRpcParser->_xh['isf_reason']); |
584 | 584 | } elseif ($xmlRpcParser->_xh['isf']) { |
585 | 585 | /// @todo separate better the various cases, as we have done in Request::parseResponse: invalid xml-rpc vs. |
@@ -587,7 +587,7 @@ discard block |
||
587 | 587 | return new Response( |
588 | 588 | 0, |
589 | 589 | PhpXmlRpc::$xmlrpcerr['invalid_request'], |
590 | - PhpXmlRpc::$xmlrpcstr['invalid_request'] . ' ' . $xmlRpcParser->_xh['isf_reason']); |
|
590 | + PhpXmlRpc::$xmlrpcstr['invalid_request'].' '.$xmlRpcParser->_xh['isf_reason']); |
|
591 | 591 | } else { |
592 | 592 | // small layering violation in favor of speed and memory usage: we should allow the 'execute' method handle |
593 | 593 | // this, but in the most common scenario (xml-rpc values type server with some methods registered as phpvals) |
@@ -597,20 +597,20 @@ discard block |
||
597 | 597 | ($this->dmap[$xmlRpcParser->_xh['method']]['parameters_type'] != 'xmlrpcvals') |
598 | 598 | ) |
599 | 599 | ) { |
600 | - if ($this->debug > 1) { |
|
601 | - $this->debugmsg("\n+++PARSED+++\n" . var_export($xmlRpcParser->_xh['params'], true) . "\n+++END+++"); |
|
600 | + if ($this->debug>1) { |
|
601 | + $this->debugmsg("\n+++PARSED+++\n".var_export($xmlRpcParser->_xh['params'], true)."\n+++END+++"); |
|
602 | 602 | } |
603 | 603 | |
604 | 604 | return $this->execute($xmlRpcParser->_xh['method'], $xmlRpcParser->_xh['params'], $xmlRpcParser->_xh['pt']); |
605 | 605 | } else { |
606 | 606 | // build a Request object with data parsed from xml and add parameters in |
607 | 607 | $req = new Request($xmlRpcParser->_xh['method']); |
608 | - for ($i = 0; $i < count($xmlRpcParser->_xh['params']); $i++) { |
|
608 | + for ($i = 0; $i<count($xmlRpcParser->_xh['params']); $i++) { |
|
609 | 609 | $req->addParam($xmlRpcParser->_xh['params'][$i]); |
610 | 610 | } |
611 | 611 | |
612 | - if ($this->debug > 1) { |
|
613 | - $this->debugmsg("\n+++PARSED+++\n" . var_export($req, true) . "\n+++END+++"); |
|
612 | + if ($this->debug>1) { |
|
613 | + $this->debugmsg("\n+++PARSED+++\n".var_export($req, true)."\n+++END+++"); |
|
614 | 614 | } |
615 | 615 | |
616 | 616 | return $this->execute($req); |
@@ -662,7 +662,7 @@ discard block |
||
662 | 662 | return new Response( |
663 | 663 | 0, |
664 | 664 | PhpXmlRpc::$xmlrpcerr['incorrect_params'], |
665 | - PhpXmlRpc::$xmlrpcstr['incorrect_params'] . ": {$errStr}" |
|
665 | + PhpXmlRpc::$xmlrpcstr['incorrect_params'].": {$errStr}" |
|
666 | 666 | ); |
667 | 667 | } |
668 | 668 | } |
@@ -677,7 +677,7 @@ discard block |
||
677 | 677 | // build string representation of function 'name' |
678 | 678 | if (is_array($func)) { |
679 | 679 | if (is_object($func[0])) { |
680 | - $funcName = get_class($func[0]) . '->' . $func[1]; |
|
680 | + $funcName = get_class($func[0]).'->'.$func[1]; |
|
681 | 681 | } else { |
682 | 682 | $funcName = implode('::', $func); |
683 | 683 | } |
@@ -689,23 +689,23 @@ discard block |
||
689 | 689 | |
690 | 690 | // verify that function to be invoked is in fact callable |
691 | 691 | if (!is_callable($func)) { |
692 | - $this->getLogger()->error("XML-RPC: " . __METHOD__ . ": function '$funcName' registered as method handler is not callable"); |
|
692 | + $this->getLogger()->error("XML-RPC: ".__METHOD__.": function '$funcName' registered as method handler is not callable"); |
|
693 | 693 | return new Response( |
694 | 694 | 0, |
695 | 695 | PhpXmlRpc::$xmlrpcerr['server_error'], |
696 | - PhpXmlRpc::$xmlrpcstr['server_error'] . ": no function matches method" |
|
696 | + PhpXmlRpc::$xmlrpcstr['server_error'].": no function matches method" |
|
697 | 697 | ); |
698 | 698 | } |
699 | 699 | |
700 | 700 | if (isset($dmap[$methodName]['exception_handling'])) { |
701 | - $exception_handling = (int)$dmap[$methodName]['exception_handling']; |
|
701 | + $exception_handling = (int) $dmap[$methodName]['exception_handling']; |
|
702 | 702 | } else { |
703 | 703 | $exception_handling = $this->exception_handling; |
704 | 704 | } |
705 | 705 | |
706 | 706 | // If debug level is 3, we should catch all errors generated during processing of user function, and log them |
707 | 707 | // as part of response |
708 | - if ($this->debug > 2) { |
|
708 | + if ($this->debug>2) { |
|
709 | 709 | self::$_xmlrpcs_prev_ehandler = set_error_handler(array('\PhpXmlRpc\Server', '_xmlrpcs_errorHandler')); |
710 | 710 | } |
711 | 711 | |
@@ -719,14 +719,14 @@ discard block |
||
719 | 719 | $r = call_user_func($func, $req); |
720 | 720 | } |
721 | 721 | if (!is_a($r, 'PhpXmlRpc\Response')) { |
722 | - $this->getLogger()->error("XML-RPC: " . __METHOD__ . ": function '$funcName' registered as method handler does not return an xmlrpc response object but a " . gettype($r)); |
|
722 | + $this->getLogger()->error("XML-RPC: ".__METHOD__.": function '$funcName' registered as method handler does not return an xmlrpc response object but a ".gettype($r)); |
|
723 | 723 | if (is_a($r, 'PhpXmlRpc\Value')) { |
724 | 724 | $r = new Response($r); |
725 | 725 | } else { |
726 | 726 | $r = new Response( |
727 | 727 | 0, |
728 | 728 | PhpXmlRpc::$xmlrpcerr['server_error'], |
729 | - PhpXmlRpc::$xmlrpcstr['server_error'] . ": function does not return xmlrpc response object" |
|
729 | + PhpXmlRpc::$xmlrpcstr['server_error'].": function does not return xmlrpc response object" |
|
730 | 730 | ); |
731 | 731 | } |
732 | 732 | } |
@@ -741,7 +741,7 @@ discard block |
||
741 | 741 | $r = call_user_func_array($func, array($methodName, $params, $this->user_data)); |
742 | 742 | // mimic EPI behaviour: if we get an array that looks like an error, make it an error response |
743 | 743 | if (is_array($r) && array_key_exists('faultCode', $r) && array_key_exists('faultString', $r)) { |
744 | - $r = new Response(0, (integer)$r['faultCode'], (string)$r['faultString']); |
|
744 | + $r = new Response(0, (integer) $r['faultCode'], (string) $r['faultString']); |
|
745 | 745 | } else { |
746 | 746 | // functions using EPI api should NOT return resp objects, so make sure we encode the |
747 | 747 | // return type correctly |
@@ -766,7 +766,7 @@ discard block |
||
766 | 766 | // proper error-response |
767 | 767 | switch ($exception_handling) { |
768 | 768 | case 2: |
769 | - if ($this->debug > 2) { |
|
769 | + if ($this->debug>2) { |
|
770 | 770 | if (self::$_xmlrpcs_prev_ehandler) { |
771 | 771 | set_error_handler(self::$_xmlrpcs_prev_ehandler); |
772 | 772 | } else { |
@@ -789,7 +789,7 @@ discard block |
||
789 | 789 | // proper error-response |
790 | 790 | switch ($exception_handling) { |
791 | 791 | case 2: |
792 | - if ($this->debug > 2) { |
|
792 | + if ($this->debug>2) { |
|
793 | 793 | if (self::$_xmlrpcs_prev_ehandler) { |
794 | 794 | set_error_handler(self::$_xmlrpcs_prev_ehandler); |
795 | 795 | } else { |
@@ -809,7 +809,7 @@ discard block |
||
809 | 809 | } |
810 | 810 | } |
811 | 811 | |
812 | - if ($this->debug > 2) { |
|
812 | + if ($this->debug>2) { |
|
813 | 813 | // note: restore the error handler we found before calling the user func, even if it has been changed |
814 | 814 | // inside the func itself |
815 | 815 | if (self::$_xmlrpcs_prev_ehandler) { |
@@ -875,7 +875,7 @@ discard block |
||
875 | 875 | */ |
876 | 876 | protected function debugmsg($string) |
877 | 877 | { |
878 | - $this->debug_info .= $string . "\n"; |
|
878 | + $this->debug_info .= $string."\n"; |
|
879 | 879 | } |
880 | 880 | |
881 | 881 | /** |
@@ -885,9 +885,9 @@ discard block |
||
885 | 885 | protected function xml_header($charsetEncoding = '') |
886 | 886 | { |
887 | 887 | if ($charsetEncoding != '') { |
888 | - return "<?xml version=\"1.0\" encoding=\"$charsetEncoding\"?" . ">\n"; |
|
888 | + return "<?xml version=\"1.0\" encoding=\"$charsetEncoding\"?".">\n"; |
|
889 | 889 | } else { |
890 | - return "<?xml version=\"1.0\"?" . ">\n"; |
|
890 | + return "<?xml version=\"1.0\"?".">\n"; |
|
891 | 891 | } |
892 | 892 | } |
893 | 893 | |
@@ -1180,7 +1180,7 @@ discard block |
||
1180 | 1180 | $i++; // for error message, we count params from 1 |
1181 | 1181 | return static::_xmlrpcs_multicall_error(new Response(0, |
1182 | 1182 | PhpXmlRpc::$xmlrpcerr['incorrect_params'], |
1183 | - PhpXmlRpc::$xmlrpcstr['incorrect_params'] . ": probable xml error in param " . $i)); |
|
1183 | + PhpXmlRpc::$xmlrpcstr['incorrect_params'].": probable xml error in param ".$i)); |
|
1184 | 1184 | } |
1185 | 1185 | } |
1186 | 1186 | |
@@ -1261,7 +1261,7 @@ discard block |
||
1261 | 1261 | } |
1262 | 1262 | } else { |
1263 | 1263 | $numCalls = count($req); |
1264 | - for ($i = 0; $i < $numCalls; $i++) { |
|
1264 | + for ($i = 0; $i<$numCalls; $i++) { |
|
1265 | 1265 | $result[$i] = static::_xmlrpcs_multicall_do_call_phpvals($server, $req[$i]); |
1266 | 1266 | } |
1267 | 1267 | } |