@@ -152,7 +152,7 @@ discard block |
||
152 | 152 | */ |
153 | 153 | public static function xmlrpc_debugmsg($msg) |
154 | 154 | { |
155 | - static::$_xmlrpc_debuginfo .= $msg . "\n"; |
|
155 | + static::$_xmlrpc_debuginfo .= $msg."\n"; |
|
156 | 156 | } |
157 | 157 | |
158 | 158 | /** |
@@ -160,7 +160,7 @@ discard block |
||
160 | 160 | */ |
161 | 161 | public static function error_occurred($msg) |
162 | 162 | { |
163 | - static::$_xmlrpcs_occurred_errors .= $msg . "\n"; |
|
163 | + static::$_xmlrpcs_occurred_errors .= $msg."\n"; |
|
164 | 164 | } |
165 | 165 | |
166 | 166 | /** |
@@ -179,10 +179,10 @@ discard block |
||
179 | 179 | // user debug info should be encoded by the end user using the INTERNAL_ENCODING |
180 | 180 | $out = ''; |
181 | 181 | if ($this->debug_info != '') { |
182 | - $out .= "<!-- SERVER DEBUG INFO (BASE64 ENCODED):\n" . base64_encode($this->debug_info) . "\n-->\n"; |
|
182 | + $out .= "<!-- SERVER DEBUG INFO (BASE64 ENCODED):\n".base64_encode($this->debug_info)."\n-->\n"; |
|
183 | 183 | } |
184 | 184 | if (static::$_xmlrpc_debuginfo != '') { |
185 | - $out .= "<!-- DEBUG INFO:\n" . Charset::instance()->encodeEntities(str_replace('--', '_-', static::$_xmlrpc_debuginfo), PhpXmlRpc::$xmlrpc_internalencoding, $charsetEncoding) . "\n-->\n"; |
|
185 | + $out .= "<!-- DEBUG INFO:\n".Charset::instance()->encodeEntities(str_replace('--', '_-', static::$_xmlrpc_debuginfo), PhpXmlRpc::$xmlrpc_internalencoding, $charsetEncoding)."\n-->\n"; |
|
186 | 186 | // NB: a better solution MIGHT be to use CDATA, but we need to insert it |
187 | 187 | // into return payload AFTER the beginning tag |
188 | 188 | //$out .= "<![CDATA[ DEBUG INFO:\n\n" . str_replace(']]>', ']_]_>', static::$_xmlrpc_debuginfo) . "\n]]>\n"; |
@@ -212,8 +212,8 @@ discard block |
||
212 | 212 | $this->debug_info = ''; |
213 | 213 | |
214 | 214 | // Save what we received, before parsing it |
215 | - if ($this->debug > 1) { |
|
216 | - $this->debugmsg("+++GOT+++\n" . $data . "\n+++END+++"); |
|
215 | + if ($this->debug>1) { |
|
216 | + $this->debugmsg("+++GOT+++\n".$data."\n+++END+++"); |
|
217 | 217 | } |
218 | 218 | |
219 | 219 | $r = $this->parseRequestHeaders($data, $reqCharset, $respCharset, $respEncoding); |
@@ -225,14 +225,14 @@ discard block |
||
225 | 225 | // save full body of request into response, for more debugging usages |
226 | 226 | $r->raw_data = $rawData; |
227 | 227 | |
228 | - if ($this->debug > 2 && static::$_xmlrpcs_occurred_errors) { |
|
229 | - $this->debugmsg("+++PROCESSING ERRORS AND WARNINGS+++\n" . |
|
230 | - static::$_xmlrpcs_occurred_errors . "+++END+++"); |
|
228 | + if ($this->debug>2 && static::$_xmlrpcs_occurred_errors) { |
|
229 | + $this->debugmsg("+++PROCESSING ERRORS AND WARNINGS+++\n". |
|
230 | + static::$_xmlrpcs_occurred_errors."+++END+++"); |
|
231 | 231 | } |
232 | 232 | |
233 | 233 | $payload = $this->xml_header($respCharset); |
234 | - if ($this->debug > 0) { |
|
235 | - $payload = $payload . $this->serializeDebug($respCharset); |
|
234 | + if ($this->debug>0) { |
|
235 | + $payload = $payload.$this->serializeDebug($respCharset); |
|
236 | 236 | } |
237 | 237 | |
238 | 238 | // G. Giunta 2006-01-27: do not create response serialization if it has |
@@ -240,7 +240,7 @@ discard block |
||
240 | 240 | if (empty($r->payload)) { |
241 | 241 | $r->serialize($respCharset); |
242 | 242 | } |
243 | - $payload = $payload . $r->payload; |
|
243 | + $payload = $payload.$r->payload; |
|
244 | 244 | |
245 | 245 | if ($returnPayload) { |
246 | 246 | return $payload; |
@@ -249,7 +249,7 @@ discard block |
||
249 | 249 | // if we get a warning/error that has output some text before here, then we cannot |
250 | 250 | // add a new header. We cannot say we are sending xml, either... |
251 | 251 | if (!headers_sent()) { |
252 | - header('Content-Type: ' . $r->content_type); |
|
252 | + header('Content-Type: '.$r->content_type); |
|
253 | 253 | // we do not know if client actually told us an accepted charset, but if he did |
254 | 254 | // we have to tell him what we did |
255 | 255 | header("Vary: Accept-Charset"); |
@@ -275,10 +275,10 @@ discard block |
||
275 | 275 | // do not output content-length header if php is compressing output for us: |
276 | 276 | // it will mess up measurements |
277 | 277 | if ($phpNoSelfCompress) { |
278 | - header('Content-Length: ' . (int)strlen($payload)); |
|
278 | + header('Content-Length: '.(int) strlen($payload)); |
|
279 | 279 | } |
280 | 280 | } else { |
281 | - error_log('XML-RPC: ' . __METHOD__ . ': http headers already sent before response is fully generated. Check for php warning or error messages'); |
|
281 | + error_log('XML-RPC: '.__METHOD__.': http headers already sent before response is fully generated. Check for php warning or error messages'); |
|
282 | 282 | } |
283 | 283 | |
284 | 284 | print $payload; |
@@ -327,9 +327,9 @@ discard block |
||
327 | 327 | $numParams = count($in); |
328 | 328 | } |
329 | 329 | foreach ($sigs as $curSig) { |
330 | - if (count($curSig) == $numParams + 1) { |
|
330 | + if (count($curSig) == $numParams+1) { |
|
331 | 331 | $itsOK = 1; |
332 | - for ($n = 0; $n < $numParams; $n++) { |
|
332 | + for ($n = 0; $n<$numParams; $n++) { |
|
333 | 333 | if (is_object($in)) { |
334 | 334 | $p = $in->getParam($n); |
335 | 335 | if ($p->kindOf() == 'scalar') { |
@@ -342,10 +342,10 @@ discard block |
||
342 | 342 | } |
343 | 343 | |
344 | 344 | // param index is $n+1, as first member of sig is return type |
345 | - if ($pt != $curSig[$n + 1] && $curSig[$n + 1] != Value::$xmlrpcValue) { |
|
345 | + if ($pt != $curSig[$n+1] && $curSig[$n+1] != Value::$xmlrpcValue) { |
|
346 | 346 | $itsOK = 0; |
347 | - $pno = $n + 1; |
|
348 | - $wanted = $curSig[$n + 1]; |
|
347 | + $pno = $n+1; |
|
348 | + $wanted = $curSig[$n+1]; |
|
349 | 349 | $got = $pt; |
350 | 350 | break; |
351 | 351 | } |
@@ -372,10 +372,10 @@ discard block |
||
372 | 372 | // check if $_SERVER is populated: it might have been disabled via ini file |
373 | 373 | // (this is true even when in CLI mode) |
374 | 374 | if (count($_SERVER) == 0) { |
375 | - error_log('XML-RPC: ' . __METHOD__ . ': cannot parse request headers as $_SERVER is not populated'); |
|
375 | + error_log('XML-RPC: '.__METHOD__.': cannot parse request headers as $_SERVER is not populated'); |
|
376 | 376 | } |
377 | 377 | |
378 | - if ($this->debug > 1) { |
|
378 | + if ($this->debug>1) { |
|
379 | 379 | if (function_exists('getallheaders')) { |
380 | 380 | $this->debugmsg(''); // empty line |
381 | 381 | foreach (getallheaders() as $name => $val) { |
@@ -397,13 +397,13 @@ discard block |
||
397 | 397 | if (function_exists('gzinflate') && in_array($contentEncoding, $this->accepted_compression)) { |
398 | 398 | if ($contentEncoding == 'deflate' && $degzdata = @gzuncompress($data)) { |
399 | 399 | $data = $degzdata; |
400 | - if ($this->debug > 1) { |
|
401 | - $this->debugmsg("\n+++INFLATED REQUEST+++[" . strlen($data) . " chars]+++\n" . $data . "\n+++END+++"); |
|
400 | + if ($this->debug>1) { |
|
401 | + $this->debugmsg("\n+++INFLATED REQUEST+++[".strlen($data)." chars]+++\n".$data."\n+++END+++"); |
|
402 | 402 | } |
403 | 403 | } elseif ($contentEncoding == 'gzip' && $degzdata = @gzinflate(substr($data, 10))) { |
404 | 404 | $data = $degzdata; |
405 | - if ($this->debug > 1) { |
|
406 | - $this->debugmsg("+++INFLATED REQUEST+++[" . strlen($data) . " chars]+++\n" . $data . "\n+++END+++"); |
|
405 | + if ($this->debug>1) { |
|
406 | + $this->debugmsg("+++INFLATED REQUEST+++[".strlen($data)." chars]+++\n".$data."\n+++END+++"); |
|
407 | 407 | } |
408 | 408 | } else { |
409 | 409 | $r = new Response(0, PhpXmlRpc::$xmlrpcerr['server_decompress_fail'], PhpXmlRpc::$xmlrpcstr['server_decompress_fail']); |
@@ -487,7 +487,7 @@ discard block |
||
487 | 487 | if (extension_loaded('mbstring')) { |
488 | 488 | $data = mb_convert_encoding($data, 'UTF-8', $reqEncoding); |
489 | 489 | } else { |
490 | - error_log('XML-RPC: ' . __METHOD__ . ': invalid charset encoding of received request: ' . $reqEncoding); |
|
490 | + error_log('XML-RPC: '.__METHOD__.': invalid charset encoding of received request: '.$reqEncoding); |
|
491 | 491 | } |
492 | 492 | } |
493 | 493 | } |
@@ -505,16 +505,16 @@ discard block |
||
505 | 505 | |
506 | 506 | $xmlRpcParser = new XMLParser($options); |
507 | 507 | $xmlRpcParser->parse($data, $this->functions_parameters_type, XMLParser::ACCEPT_REQUEST); |
508 | - if ($xmlRpcParser->_xh['isf'] > 2) { |
|
508 | + if ($xmlRpcParser->_xh['isf']>2) { |
|
509 | 509 | // (BC) we return XML error as a faultCode |
510 | 510 | preg_match('/^XML error ([0-9]+)/', $xmlRpcParser->_xh['isf_reason'], $matches); |
511 | 511 | $r = new Response(0, |
512 | - PhpXmlRpc::$xmlrpcerrxml + $matches[1], |
|
512 | + PhpXmlRpc::$xmlrpcerrxml+$matches[1], |
|
513 | 513 | $xmlRpcParser->_xh['isf_reason']); |
514 | 514 | } elseif ($xmlRpcParser->_xh['isf']) { |
515 | 515 | $r = new Response(0, |
516 | 516 | PhpXmlRpc::$xmlrpcerr['invalid_request'], |
517 | - PhpXmlRpc::$xmlrpcstr['invalid_request'] . ' ' . $xmlRpcParser->_xh['isf_reason']); |
|
517 | + PhpXmlRpc::$xmlrpcstr['invalid_request'].' '.$xmlRpcParser->_xh['isf_reason']); |
|
518 | 518 | } else { |
519 | 519 | // small layering violation in favor of speed and memory usage: |
520 | 520 | // we should allow the 'execute' method handle this, but in the |
@@ -525,20 +525,20 @@ discard block |
||
525 | 525 | ($this->dmap[$xmlRpcParser->_xh['method']]['parameters_type'] == 'phpvals') |
526 | 526 | ) |
527 | 527 | ) { |
528 | - if ($this->debug > 1) { |
|
529 | - $this->debugmsg("\n+++PARSED+++\n" . var_export($xmlRpcParser->_xh['params'], true) . "\n+++END+++"); |
|
528 | + if ($this->debug>1) { |
|
529 | + $this->debugmsg("\n+++PARSED+++\n".var_export($xmlRpcParser->_xh['params'], true)."\n+++END+++"); |
|
530 | 530 | } |
531 | 531 | $r = $this->execute($xmlRpcParser->_xh['method'], $xmlRpcParser->_xh['params'], $xmlRpcParser->_xh['pt']); |
532 | 532 | } else { |
533 | 533 | // build a Request object with data parsed from xml |
534 | 534 | $req = new Request($xmlRpcParser->_xh['method']); |
535 | 535 | // now add parameters in |
536 | - for ($i = 0; $i < count($xmlRpcParser->_xh['params']); $i++) { |
|
536 | + for ($i = 0; $i<count($xmlRpcParser->_xh['params']); $i++) { |
|
537 | 537 | $req->addParam($xmlRpcParser->_xh['params'][$i]); |
538 | 538 | } |
539 | 539 | |
540 | - if ($this->debug > 1) { |
|
541 | - $this->debugmsg("\n+++PARSED+++\n" . var_export($req, true) . "\n+++END+++"); |
|
540 | + if ($this->debug>1) { |
|
541 | + $this->debugmsg("\n+++PARSED+++\n".var_export($req, true)."\n+++END+++"); |
|
542 | 542 | } |
543 | 543 | $r = $this->execute($req); |
544 | 544 | } |
@@ -591,7 +591,7 @@ discard block |
||
591 | 591 | return new Response( |
592 | 592 | 0, |
593 | 593 | PhpXmlRpc::$xmlrpcerr['incorrect_params'], |
594 | - PhpXmlRpc::$xmlrpcstr['incorrect_params'] . ": ${errStr}" |
|
594 | + PhpXmlRpc::$xmlrpcstr['incorrect_params'].": ${errStr}" |
|
595 | 595 | ); |
596 | 596 | } |
597 | 597 | } |
@@ -604,7 +604,7 @@ discard block |
||
604 | 604 | |
605 | 605 | if (is_array($func)) { |
606 | 606 | if (is_object($func[0])) { |
607 | - $funcName = get_class($func[0]) . '->' . $func[1]; |
|
607 | + $funcName = get_class($func[0]).'->'.$func[1]; |
|
608 | 608 | } else { |
609 | 609 | $funcName = implode('::', $func); |
610 | 610 | } |
@@ -616,17 +616,17 @@ discard block |
||
616 | 616 | |
617 | 617 | // verify that function to be invoked is in fact callable |
618 | 618 | if (!is_callable($func)) { |
619 | - error_log("XML-RPC: " . __METHOD__ . ": function '$funcName' registered as method handler is not callable"); |
|
619 | + error_log("XML-RPC: ".__METHOD__.": function '$funcName' registered as method handler is not callable"); |
|
620 | 620 | return new Response( |
621 | 621 | 0, |
622 | 622 | PhpXmlRpc::$xmlrpcerr['server_error'], |
623 | - PhpXmlRpc::$xmlrpcstr['server_error'] . ": no function matches method" |
|
623 | + PhpXmlRpc::$xmlrpcstr['server_error'].": no function matches method" |
|
624 | 624 | ); |
625 | 625 | } |
626 | 626 | |
627 | 627 | // If debug level is 3, we should catch all errors generated during |
628 | 628 | // processing of user function, and log them as part of response |
629 | - if ($this->debug > 2) { |
|
629 | + if ($this->debug>2) { |
|
630 | 630 | self::$_xmlrpcs_prev_ehandler = set_error_handler(array('\PhpXmlRpc\Server', '_xmlrpcs_errorHandler')); |
631 | 631 | } |
632 | 632 | |
@@ -639,14 +639,14 @@ discard block |
||
639 | 639 | $r = call_user_func($func, $req); |
640 | 640 | } |
641 | 641 | if (!is_a($r, 'PhpXmlRpc\Response')) { |
642 | - error_log("XML-RPC: " . __METHOD__ . ": function '$funcName' registered as method handler does not return an xmlrpc response object but a " . gettype($r)); |
|
642 | + error_log("XML-RPC: ".__METHOD__.": function '$funcName' registered as method handler does not return an xmlrpc response object but a ".gettype($r)); |
|
643 | 643 | if (is_a($r, 'PhpXmlRpc\Value')) { |
644 | 644 | $r = new Response($r); |
645 | 645 | } else { |
646 | 646 | $r = new Response( |
647 | 647 | 0, |
648 | 648 | PhpXmlRpc::$xmlrpcerr['server_error'], |
649 | - PhpXmlRpc::$xmlrpcstr['server_error'] . ": function does not return xmlrpc response object" |
|
649 | + PhpXmlRpc::$xmlrpcstr['server_error'].": function does not return xmlrpc response object" |
|
650 | 650 | ); |
651 | 651 | } |
652 | 652 | } |
@@ -662,7 +662,7 @@ discard block |
||
662 | 662 | // mimic EPI behaviour: if we get an array that looks like an error, make it |
663 | 663 | // an eror response |
664 | 664 | if (is_array($r) && array_key_exists('faultCode', $r) && array_key_exists('faultString', $r)) { |
665 | - $r = new Response(0, (integer)$r['faultCode'], (string)$r['faultString']); |
|
665 | + $r = new Response(0, (integer) $r['faultCode'], (string) $r['faultString']); |
|
666 | 666 | } else { |
667 | 667 | // functions using EPI api should NOT return resp objects, |
668 | 668 | // so make sure we encode the return type correctly |
@@ -686,7 +686,7 @@ discard block |
||
686 | 686 | // in the called function, we wrap it in a proper error-response |
687 | 687 | switch ($this->exception_handling) { |
688 | 688 | case 2: |
689 | - if ($this->debug > 2) { |
|
689 | + if ($this->debug>2) { |
|
690 | 690 | if (self::$_xmlrpcs_prev_ehandler) { |
691 | 691 | set_error_handler(self::$_xmlrpcs_prev_ehandler); |
692 | 692 | } else { |
@@ -702,7 +702,7 @@ discard block |
||
702 | 702 | $r = new Response(0, PhpXmlRpc::$xmlrpcerr['server_error'], PhpXmlRpc::$xmlrpcstr['server_error']); |
703 | 703 | } |
704 | 704 | } |
705 | - if ($this->debug > 2) { |
|
705 | + if ($this->debug>2) { |
|
706 | 706 | // note: restore the error handler we found before calling the |
707 | 707 | // user func, even if it has been changed inside the func itself |
708 | 708 | if (self::$_xmlrpcs_prev_ehandler) { |
@@ -722,7 +722,7 @@ discard block |
||
722 | 722 | */ |
723 | 723 | protected function debugmsg($string) |
724 | 724 | { |
725 | - $this->debug_info .= $string . "\n"; |
|
725 | + $this->debug_info .= $string."\n"; |
|
726 | 726 | } |
727 | 727 | |
728 | 728 | /** |
@@ -732,9 +732,9 @@ discard block |
||
732 | 732 | protected function xml_header($charsetEncoding = '') |
733 | 733 | { |
734 | 734 | if ($charsetEncoding != '') { |
735 | - return "<?xml version=\"1.0\" encoding=\"$charsetEncoding\"?" . ">\n"; |
|
735 | + return "<?xml version=\"1.0\" encoding=\"$charsetEncoding\"?".">\n"; |
|
736 | 736 | } else { |
737 | - return "<?xml version=\"1.0\"?" . ">\n"; |
|
737 | + return "<?xml version=\"1.0\"?".">\n"; |
|
738 | 738 | } |
739 | 739 | } |
740 | 740 | |
@@ -967,12 +967,12 @@ discard block |
||
967 | 967 | } |
968 | 968 | |
969 | 969 | $req = new Request($methName->scalarval()); |
970 | - foreach($params as $i => $param) { |
|
970 | + foreach ($params as $i => $param) { |
|
971 | 971 | if (!$req->addParam($param)) { |
972 | 972 | $i++; // for error message, we count params from 1 |
973 | 973 | return static::_xmlrpcs_multicall_error(new Response(0, |
974 | 974 | PhpXmlRpc::$xmlrpcerr['incorrect_params'], |
975 | - PhpXmlRpc::$xmlrpcstr['incorrect_params'] . ": probable xml error in param " . $i)); |
|
975 | + PhpXmlRpc::$xmlrpcstr['incorrect_params'].": probable xml error in param ".$i)); |
|
976 | 976 | } |
977 | 977 | } |
978 | 978 | |
@@ -1039,12 +1039,12 @@ discard block |
||
1039 | 1039 | // let accept a plain list of php parameters, beside a single xmlrpc msg object |
1040 | 1040 | if (is_object($req)) { |
1041 | 1041 | $calls = $req->getParam(0); |
1042 | - foreach($calls as $call) { |
|
1042 | + foreach ($calls as $call) { |
|
1043 | 1043 | $result[] = static::_xmlrpcs_multicall_do_call($server, $call); |
1044 | 1044 | } |
1045 | 1045 | } else { |
1046 | 1046 | $numCalls = count($req); |
1047 | - for ($i = 0; $i < $numCalls; $i++) { |
|
1047 | + for ($i = 0; $i<$numCalls; $i++) { |
|
1048 | 1048 | $result[$i] = static::_xmlrpcs_multicall_do_call_phpvals($server, $req[$i]); |
1049 | 1049 | } |
1050 | 1050 | } |