@@ -251,7 +251,7 @@ discard block |
||
251 | 251 | public function getOptions() |
252 | 252 | { |
253 | 253 | $values = array(); |
254 | - foreach(static::$options as $opt) { |
|
254 | + foreach (static::$options as $opt) { |
|
255 | 255 | $values[$opt] = $this->getOption($opt); |
256 | 256 | } |
257 | 257 | return $values; |
@@ -264,7 +264,7 @@ discard block |
||
264 | 264 | */ |
265 | 265 | public function setOptions($options) |
266 | 266 | { |
267 | - foreach($options as $name => $value) { |
|
267 | + foreach ($options as $name => $value) { |
|
268 | 268 | $this->setOption($name, $value); |
269 | 269 | } |
270 | 270 | |
@@ -302,7 +302,7 @@ discard block |
||
302 | 302 | */ |
303 | 303 | public static function xmlrpc_debugmsg($msg) |
304 | 304 | { |
305 | - static::$_xmlrpc_debuginfo .= $msg . "\n"; |
|
305 | + static::$_xmlrpc_debuginfo .= $msg."\n"; |
|
306 | 306 | } |
307 | 307 | |
308 | 308 | /** |
@@ -314,7 +314,7 @@ discard block |
||
314 | 314 | */ |
315 | 315 | public static function error_occurred($msg) |
316 | 316 | { |
317 | - static::$_xmlrpcs_occurred_errors .= $msg . "\n"; |
|
317 | + static::$_xmlrpcs_occurred_errors .= $msg."\n"; |
|
318 | 318 | } |
319 | 319 | |
320 | 320 | /** |
@@ -335,10 +335,10 @@ discard block |
||
335 | 335 | // user debug info should be encoded by the end user using the INTERNAL_ENCODING |
336 | 336 | $out = ''; |
337 | 337 | if ($this->debug_info != '') { |
338 | - $out .= "<!-- SERVER DEBUG INFO (BASE64 ENCODED):\n" . base64_encode($this->debug_info) . "\n-->\n"; |
|
338 | + $out .= "<!-- SERVER DEBUG INFO (BASE64 ENCODED):\n".base64_encode($this->debug_info)."\n-->\n"; |
|
339 | 339 | } |
340 | 340 | if (static::$_xmlrpc_debuginfo != '') { |
341 | - $out .= "<!-- DEBUG INFO:\n" . $this->getCharsetEncoder()->encodeEntities(str_replace('--', '_-', static::$_xmlrpc_debuginfo), PhpXmlRpc::$xmlrpc_internalencoding, $charsetEncoding) . "\n-->\n"; |
|
341 | + $out .= "<!-- DEBUG INFO:\n".$this->getCharsetEncoder()->encodeEntities(str_replace('--', '_-', static::$_xmlrpc_debuginfo), PhpXmlRpc::$xmlrpc_internalencoding, $charsetEncoding)."\n-->\n"; |
|
342 | 342 | // NB: a better solution MIGHT be to use CDATA, but we need to insert it |
343 | 343 | // into return payload AFTER the beginning tag |
344 | 344 | //$out .= "<![CDATA[ DEBUG INFO:\n\n" . str_replace(']]>', ']_]_>', static::$_xmlrpc_debuginfo) . "\n]]>\n"; |
@@ -367,8 +367,8 @@ discard block |
||
367 | 367 | $this->debug_info = ''; |
368 | 368 | |
369 | 369 | // Save what we received, before parsing it |
370 | - if ($this->debug > 1) { |
|
371 | - $this->debugMsg("+++GOT+++\n" . $data . "\n+++END+++"); |
|
370 | + if ($this->debug>1) { |
|
371 | + $this->debugMsg("+++GOT+++\n".$data."\n+++END+++"); |
|
372 | 372 | } |
373 | 373 | |
374 | 374 | $resp = $this->parseRequestHeaders($data, $reqCharset, $respCharset, $respEncoding); |
@@ -385,13 +385,13 @@ discard block |
||
385 | 385 | $resp->raw_data = $rawData; |
386 | 386 | } |
387 | 387 | |
388 | - if ($this->debug > 2 && static::$_xmlrpcs_occurred_errors != '') { |
|
389 | - $this->debugMsg("+++PROCESSING ERRORS AND WARNINGS+++\n" . |
|
390 | - static::$_xmlrpcs_occurred_errors . "+++END+++"); |
|
388 | + if ($this->debug>2 && static::$_xmlrpcs_occurred_errors != '') { |
|
389 | + $this->debugMsg("+++PROCESSING ERRORS AND WARNINGS+++\n". |
|
390 | + static::$_xmlrpcs_occurred_errors."+++END+++"); |
|
391 | 391 | } |
392 | 392 | |
393 | 393 | $header = $resp->xml_header($respCharset); |
394 | - if ($this->debug > 0) { |
|
394 | + if ($this->debug>0) { |
|
395 | 395 | $header .= $this->serializeDebug($respCharset); |
396 | 396 | } |
397 | 397 | |
@@ -402,7 +402,7 @@ discard block |
||
402 | 402 | if (empty($payload)) { |
403 | 403 | $payload = $resp->serialize($respCharset); |
404 | 404 | } |
405 | - $payload = $header . $payload; |
|
405 | + $payload = $header.$payload; |
|
406 | 406 | |
407 | 407 | if ($returnPayload) { |
408 | 408 | return $payload; |
@@ -411,7 +411,7 @@ discard block |
||
411 | 411 | // if we get a warning/error that has output some text before here, then we cannot |
412 | 412 | // add a new header. We cannot say we are sending xml, either... |
413 | 413 | if (!headers_sent()) { |
414 | - header('Content-Type: ' . $resp->getContentType()); |
|
414 | + header('Content-Type: '.$resp->getContentType()); |
|
415 | 415 | // we do not know if client actually told us an accepted charset, but if it did we have to tell it what we did |
416 | 416 | header("Vary: Accept-Charset"); |
417 | 417 | |
@@ -434,12 +434,12 @@ discard block |
||
434 | 434 | // Note that Apache/mod_php will add (and even alter!) the Content-Length header on its own, but only for |
435 | 435 | // responses up to 8000 bytes |
436 | 436 | if ($phpNoSelfCompress) { |
437 | - header('Content-Length: ' . (int)strlen($payload)); |
|
437 | + header('Content-Length: '.(int) strlen($payload)); |
|
438 | 438 | } |
439 | 439 | } else { |
440 | 440 | /// @todo allow the user to easily subclass this in a way which allows the resp. headers to be already sent |
441 | 441 | /// by now without flagging it as an error. Possibly check for presence of Content-Type header |
442 | - $this->getLogger()->error('XML-RPC: ' . __METHOD__ . ': http headers already sent before response is fully generated. Check for php warning or error messages'); |
|
442 | + $this->getLogger()->error('XML-RPC: '.__METHOD__.': http headers already sent before response is fully generated. Check for php warning or error messages'); |
|
443 | 443 | } |
444 | 444 | |
445 | 445 | print $payload; |
@@ -528,9 +528,9 @@ discard block |
||
528 | 528 | $numParams = count($in); |
529 | 529 | } |
530 | 530 | foreach ($sigs as $curSig) { |
531 | - if (count($curSig) == $numParams + 1) { |
|
531 | + if (count($curSig) == $numParams+1) { |
|
532 | 532 | $itsOK = 1; |
533 | - for ($n = 0; $n < $numParams; $n++) { |
|
533 | + for ($n = 0; $n<$numParams; $n++) { |
|
534 | 534 | if (is_object($in)) { |
535 | 535 | $p = $in->getParam($n); |
536 | 536 | if ($p->kindOf() == 'scalar') { |
@@ -543,10 +543,10 @@ discard block |
||
543 | 543 | } |
544 | 544 | |
545 | 545 | // param index is $n+1, as first member of sig is return type |
546 | - if ($pt != $curSig[$n + 1] && $curSig[$n + 1] != Value::$xmlrpcValue) { |
|
546 | + if ($pt != $curSig[$n+1] && $curSig[$n+1] != Value::$xmlrpcValue) { |
|
547 | 547 | $itsOK = 0; |
548 | - $pno = $n + 1; |
|
549 | - $wanted = $curSig[$n + 1]; |
|
548 | + $pno = $n+1; |
|
549 | + $wanted = $curSig[$n+1]; |
|
550 | 550 | $got = $pt; |
551 | 551 | break; |
552 | 552 | } |
@@ -573,10 +573,10 @@ discard block |
||
573 | 573 | // check if $_SERVER is populated: it might have been disabled via ini file |
574 | 574 | // (this is true even when in CLI mode) |
575 | 575 | if (count($_SERVER) == 0) { |
576 | - $this->getLogger()->error('XML-RPC: ' . __METHOD__ . ': cannot parse request headers as $_SERVER is not populated'); |
|
576 | + $this->getLogger()->error('XML-RPC: '.__METHOD__.': cannot parse request headers as $_SERVER is not populated'); |
|
577 | 577 | } |
578 | 578 | |
579 | - if ($this->debug > 1) { |
|
579 | + if ($this->debug>1) { |
|
580 | 580 | if (function_exists('getallheaders')) { |
581 | 581 | $this->debugMsg(''); // empty line |
582 | 582 | foreach (getallheaders() as $name => $val) { |
@@ -601,13 +601,13 @@ discard block |
||
601 | 601 | if (function_exists('gzinflate') && in_array($contentEncoding, $this->accepted_compression)) { |
602 | 602 | if ($contentEncoding == 'deflate' && $degzdata = @gzuncompress($data)) { |
603 | 603 | $data = $degzdata; |
604 | - if ($this->debug > 1) { |
|
605 | - $this->debugMsg("\n+++INFLATED REQUEST+++[" . strlen($data) . " chars]+++\n" . $data . "\n+++END+++"); |
|
604 | + if ($this->debug>1) { |
|
605 | + $this->debugMsg("\n+++INFLATED REQUEST+++[".strlen($data)." chars]+++\n".$data."\n+++END+++"); |
|
606 | 606 | } |
607 | 607 | } elseif ($contentEncoding == 'gzip' && $degzdata = @gzinflate(substr($data, 10))) { |
608 | 608 | $data = $degzdata; |
609 | - if ($this->debug > 1) { |
|
610 | - $this->debugMsg("+++INFLATED REQUEST+++[" . strlen($data) . " chars]+++\n" . $data . "\n+++END+++"); |
|
609 | + if ($this->debug>1) { |
|
610 | + $this->debugMsg("+++INFLATED REQUEST+++[".strlen($data)." chars]+++\n".$data."\n+++END+++"); |
|
611 | 611 | } |
612 | 612 | } else { |
613 | 613 | $r = new static::$responseClass(0, PhpXmlRpc::$xmlrpcerr['server_decompress_fail'], |
@@ -695,7 +695,7 @@ discard block |
||
695 | 695 | if ($reqEncoding == 'ISO-8859-1') { |
696 | 696 | $data = utf8_encode($data); |
697 | 697 | } else { |
698 | - $this->getLogger()->error('XML-RPC: ' . __METHOD__ . ': unsupported charset encoding of received request: ' . $reqEncoding); |
|
698 | + $this->getLogger()->error('XML-RPC: '.__METHOD__.': unsupported charset encoding of received request: '.$reqEncoding); |
|
699 | 699 | } |
700 | 700 | } |
701 | 701 | } |
@@ -729,7 +729,7 @@ discard block |
||
729 | 729 | preg_match('/^XML error ([0-9]+)/', $_xh['isf_reason'], $matches); |
730 | 730 | return new static::$responseClass( |
731 | 731 | 0, |
732 | - PhpXmlRpc::$xmlrpcerrxml + (int)$matches[1], |
|
732 | + PhpXmlRpc::$xmlrpcerrxml+(int) $matches[1], |
|
733 | 733 | $_xh['isf_reason']); |
734 | 734 | } elseif ($_xh['isf']) { |
735 | 735 | /// @todo separate better the various cases, as we have done in Request::parseResponse: invalid xml-rpc vs. |
@@ -737,7 +737,7 @@ discard block |
||
737 | 737 | return new static::$responseClass( |
738 | 738 | 0, |
739 | 739 | PhpXmlRpc::$xmlrpcerr['invalid_request'], |
740 | - PhpXmlRpc::$xmlrpcstr['invalid_request'] . ' ' . $_xh['isf_reason']); |
|
740 | + PhpXmlRpc::$xmlrpcstr['invalid_request'].' '.$_xh['isf_reason']); |
|
741 | 741 | } else { |
742 | 742 | // small layering violation in favor of speed and memory usage: we should allow the 'execute' method handle |
743 | 743 | // this, but in the most common scenario (xml-rpc values type server with some methods registered as phpvals) |
@@ -747,8 +747,8 @@ discard block |
||
747 | 747 | ($this->dmap[$_xh['method']]['parameters_type'] != 'xmlrpcvals') |
748 | 748 | ) |
749 | 749 | ) { |
750 | - if ($this->debug > 1) { |
|
751 | - $this->debugMsg("\n+++PARSED+++\n" . var_export($_xh['params'], true) . "\n+++END+++"); |
|
750 | + if ($this->debug>1) { |
|
751 | + $this->debugMsg("\n+++PARSED+++\n".var_export($_xh['params'], true)."\n+++END+++"); |
|
752 | 752 | } |
753 | 753 | |
754 | 754 | return $this->execute($_xh['method'], $_xh['params'], $_xh['pt']); |
@@ -756,12 +756,12 @@ discard block |
||
756 | 756 | // build a Request object with data parsed from xml and add parameters in |
757 | 757 | $req = new Request($_xh['method']); |
758 | 758 | /// @todo for more speed, we could just pass in the array to the constructor (and loose the type validation)... |
759 | - for ($i = 0; $i < count($_xh['params']); $i++) { |
|
759 | + for ($i = 0; $i<count($_xh['params']); $i++) { |
|
760 | 760 | $req->addParam($_xh['params'][$i]); |
761 | 761 | } |
762 | 762 | |
763 | - if ($this->debug > 1) { |
|
764 | - $this->debugMsg("\n+++PARSED+++\n" . var_export($req, true) . "\n+++END+++"); |
|
763 | + if ($this->debug>1) { |
|
764 | + $this->debugMsg("\n+++PARSED+++\n".var_export($req, true)."\n+++END+++"); |
|
765 | 765 | } |
766 | 766 | |
767 | 767 | return $this->execute($req); |
@@ -811,7 +811,7 @@ discard block |
||
811 | 811 | return new static::$responseClass( |
812 | 812 | 0, |
813 | 813 | PhpXmlRpc::$xmlrpcerr['incorrect_params'], |
814 | - PhpXmlRpc::$xmlrpcstr['incorrect_params'] . ": {$errStr}" |
|
814 | + PhpXmlRpc::$xmlrpcstr['incorrect_params'].": {$errStr}" |
|
815 | 815 | ); |
816 | 816 | } |
817 | 817 | } |
@@ -826,7 +826,7 @@ discard block |
||
826 | 826 | // build string representation of function 'name' |
827 | 827 | if (is_array($func)) { |
828 | 828 | if (is_object($func[0])) { |
829 | - $funcName = get_class($func[0]) . '->' . $func[1]; |
|
829 | + $funcName = get_class($func[0]).'->'.$func[1]; |
|
830 | 830 | } else { |
831 | 831 | $funcName = implode('::', $func); |
832 | 832 | } |
@@ -838,16 +838,16 @@ discard block |
||
838 | 838 | |
839 | 839 | // verify that function to be invoked is in fact callable |
840 | 840 | if (!is_callable($func)) { |
841 | - $this->getLogger()->error("XML-RPC: " . __METHOD__ . ": function '$funcName' registered as method handler is not callable"); |
|
841 | + $this->getLogger()->error("XML-RPC: ".__METHOD__.": function '$funcName' registered as method handler is not callable"); |
|
842 | 842 | return new static::$responseClass( |
843 | 843 | 0, |
844 | 844 | PhpXmlRpc::$xmlrpcerr['server_error'], |
845 | - PhpXmlRpc::$xmlrpcstr['server_error'] . ": no function matches method" |
|
845 | + PhpXmlRpc::$xmlrpcstr['server_error'].": no function matches method" |
|
846 | 846 | ); |
847 | 847 | } |
848 | 848 | |
849 | 849 | if (isset($dmap[$methodName]['exception_handling'])) { |
850 | - $exception_handling = (int)$dmap[$methodName]['exception_handling']; |
|
850 | + $exception_handling = (int) $dmap[$methodName]['exception_handling']; |
|
851 | 851 | } else { |
852 | 852 | $exception_handling = $this->exception_handling; |
853 | 853 | } |
@@ -868,14 +868,14 @@ discard block |
||
868 | 868 | $r = call_user_func($func, $req); |
869 | 869 | } |
870 | 870 | if (!is_a($r, 'PhpXmlRpc\Response')) { |
871 | - $this->getLogger()->error("XML-RPC: " . __METHOD__ . ": function '$funcName' registered as method handler does not return an xmlrpc response object but a " . gettype($r)); |
|
871 | + $this->getLogger()->error("XML-RPC: ".__METHOD__.": function '$funcName' registered as method handler does not return an xmlrpc response object but a ".gettype($r)); |
|
872 | 872 | if (is_a($r, 'PhpXmlRpc\Value')) { |
873 | 873 | $r = new static::$responseClass($r); |
874 | 874 | } else { |
875 | 875 | $r = new static::$responseClass( |
876 | 876 | 0, |
877 | 877 | PhpXmlRpc::$xmlrpcerr['server_error'], |
878 | - PhpXmlRpc::$xmlrpcstr['server_error'] . ": function does not return xmlrpc response object" |
|
878 | + PhpXmlRpc::$xmlrpcstr['server_error'].": function does not return xmlrpc response object" |
|
879 | 879 | ); |
880 | 880 | } |
881 | 881 | } |
@@ -890,7 +890,7 @@ discard block |
||
890 | 890 | $r = call_user_func_array($func, array($methodName, $params, $this->user_data)); |
891 | 891 | // mimic EPI behaviour: if we get an array that looks like an error, make it an error response |
892 | 892 | if (is_array($r) && array_key_exists('faultCode', $r) && array_key_exists('faultString', $r)) { |
893 | - $r = new static::$responseClass(0, (int)$r['faultCode'], (string)$r['faultString']); |
|
893 | + $r = new static::$responseClass(0, (int) $r['faultCode'], (string) $r['faultString']); |
|
894 | 894 | } else { |
895 | 895 | // functions using EPI api should NOT return resp objects, so make sure we encode the |
896 | 896 | // return type correctly |
@@ -1021,7 +1021,7 @@ discard block |
||
1021 | 1021 | */ |
1022 | 1022 | protected function debugMsg($string) |
1023 | 1023 | { |
1024 | - $this->debug_info .= $string . "\n"; |
|
1024 | + $this->debug_info .= $string."\n"; |
|
1025 | 1025 | } |
1026 | 1026 | |
1027 | 1027 | /** |
@@ -1313,7 +1313,7 @@ discard block |
||
1313 | 1313 | $i++; // for error message, we count params from 1 |
1314 | 1314 | return static::_xmlrpcs_multicall_error(new static::$responseClass(0, |
1315 | 1315 | PhpXmlRpc::$xmlrpcerr['incorrect_params'], |
1316 | - PhpXmlRpc::$xmlrpcstr['incorrect_params'] . ": probable xml error in param " . $i)); |
|
1316 | + PhpXmlRpc::$xmlrpcstr['incorrect_params'].": probable xml error in param ".$i)); |
|
1317 | 1317 | } |
1318 | 1318 | } |
1319 | 1319 | |
@@ -1394,7 +1394,7 @@ discard block |
||
1394 | 1394 | } |
1395 | 1395 | } else { |
1396 | 1396 | $numCalls = count($req); |
1397 | - for ($i = 0; $i < $numCalls; $i++) { |
|
1397 | + for ($i = 0; $i<$numCalls; $i++) { |
|
1398 | 1398 | $result[$i] = static::_xmlrpcs_multicall_do_call_phpvals($server, $req[$i]); |
1399 | 1399 | } |
1400 | 1400 | } |
@@ -1422,7 +1422,7 @@ discard block |
||
1422 | 1422 | // From PHP 8.4 the E_STRICT constant has been deprecated and will emit deprecation notices. |
1423 | 1423 | // PHP core and core extensions since PHP 8.0 and later do not emit E_STRICT notices at all. |
1424 | 1424 | // On PHP 7 series before PHP 7.4, some functions conditionally emit E_STRICT notices. |
1425 | - if (PHP_VERSION_ID >= 70400) { |
|
1425 | + if (PHP_VERSION_ID>=70400) { |
|
1426 | 1426 | static::error_occurred($errString); |
1427 | 1427 | } elseif ($errCode != E_STRICT) { |
1428 | 1428 | static::error_occurred($errString); |
@@ -1463,12 +1463,12 @@ discard block |
||
1463 | 1463 | */ |
1464 | 1464 | protected function xml_header($charsetEncoding = '') |
1465 | 1465 | { |
1466 | - $this->logDeprecation('Method ' . __METHOD__ . ' is deprecated'); |
|
1466 | + $this->logDeprecation('Method '.__METHOD__.' is deprecated'); |
|
1467 | 1467 | |
1468 | 1468 | if ($charsetEncoding != '') { |
1469 | - return "<?xml version=\"1.0\" encoding=\"$charsetEncoding\"?" . ">\n"; |
|
1469 | + return "<?xml version=\"1.0\" encoding=\"$charsetEncoding\"?".">\n"; |
|
1470 | 1470 | } else { |
1471 | - return "<?xml version=\"1.0\"?" . ">\n"; |
|
1471 | + return "<?xml version=\"1.0\"?".">\n"; |
|
1472 | 1472 | } |
1473 | 1473 | } |
1474 | 1474 | |
@@ -1484,7 +1484,7 @@ discard block |
||
1484 | 1484 | case self::OPT_FUNCTIONS_PARAMETERS_TYPE: |
1485 | 1485 | case self::OPT_PHPVALS_ENCODING_OPTIONS: |
1486 | 1486 | case self::OPT_RESPONSE_CHARSET_ENCODING: |
1487 | - $this->logDeprecation('Getting property Request::' . $name . ' is deprecated'); |
|
1487 | + $this->logDeprecation('Getting property Request::'.$name.' is deprecated'); |
|
1488 | 1488 | return $this->$name; |
1489 | 1489 | case 'accepted_charset_encodings': |
1490 | 1490 | // manually implement the 'protected property' behaviour |
@@ -1496,16 +1496,16 @@ discard block |
||
1496 | 1496 | } |
1497 | 1497 | } |
1498 | 1498 | if ($canAccess) { |
1499 | - $this->logDeprecation('Getting property Request::' . $name . ' is deprecated'); |
|
1499 | + $this->logDeprecation('Getting property Request::'.$name.' is deprecated'); |
|
1500 | 1500 | return $this->accepted_compression; |
1501 | 1501 | } else { |
1502 | - trigger_error("Cannot access protected property Server::accepted_charset_encodings in " . __FILE__, E_USER_ERROR); |
|
1502 | + trigger_error("Cannot access protected property Server::accepted_charset_encodings in ".__FILE__, E_USER_ERROR); |
|
1503 | 1503 | } |
1504 | 1504 | break; |
1505 | 1505 | default: |
1506 | 1506 | /// @todo throw instead? There are very few other places where the lib trigger errors which can potentially reach stdout... |
1507 | 1507 | $trace = debug_backtrace(DEBUG_BACKTRACE_IGNORE_ARGS, 1); |
1508 | - trigger_error('Undefined property via __get(): ' . $name . ' in ' . $trace[0]['file'] . ' on line ' . $trace[0]['line'], E_USER_WARNING); |
|
1508 | + trigger_error('Undefined property via __get(): '.$name.' in '.$trace[0]['file'].' on line '.$trace[0]['line'], E_USER_WARNING); |
|
1509 | 1509 | $result = null; |
1510 | 1510 | return $result; |
1511 | 1511 | } |
@@ -1522,7 +1522,7 @@ discard block |
||
1522 | 1522 | case self::OPT_FUNCTIONS_PARAMETERS_TYPE: |
1523 | 1523 | case self::OPT_PHPVALS_ENCODING_OPTIONS: |
1524 | 1524 | case self::OPT_RESPONSE_CHARSET_ENCODING: |
1525 | - $this->logDeprecation('Setting property Request::' . $name . ' is deprecated'); |
|
1525 | + $this->logDeprecation('Setting property Request::'.$name.' is deprecated'); |
|
1526 | 1526 | $this->$name = $value; |
1527 | 1527 | break; |
1528 | 1528 | case 'accepted_charset_encodings': |
@@ -1535,16 +1535,16 @@ discard block |
||
1535 | 1535 | } |
1536 | 1536 | } |
1537 | 1537 | if ($canAccess) { |
1538 | - $this->logDeprecation('Setting property Request::' . $name . ' is deprecated'); |
|
1538 | + $this->logDeprecation('Setting property Request::'.$name.' is deprecated'); |
|
1539 | 1539 | $this->accepted_compression = $value; |
1540 | 1540 | } else { |
1541 | - trigger_error("Cannot access protected property Server::accepted_charset_encodings in " . __FILE__, E_USER_ERROR); |
|
1541 | + trigger_error("Cannot access protected property Server::accepted_charset_encodings in ".__FILE__, E_USER_ERROR); |
|
1542 | 1542 | } |
1543 | 1543 | break; |
1544 | 1544 | default: |
1545 | 1545 | /// @todo throw instead? There are very few other places where the lib trigger errors which can potentially reach stdout... |
1546 | 1546 | $trace = debug_backtrace(DEBUG_BACKTRACE_IGNORE_ARGS, 1); |
1547 | - trigger_error('Undefined property via __set(): ' . $name . ' in ' . $trace[0]['file'] . ' on line ' . $trace[0]['line'], E_USER_WARNING); |
|
1547 | + trigger_error('Undefined property via __set(): '.$name.' in '.$trace[0]['file'].' on line '.$trace[0]['line'], E_USER_WARNING); |
|
1548 | 1548 | } |
1549 | 1549 | } |
1550 | 1550 | |
@@ -1559,7 +1559,7 @@ discard block |
||
1559 | 1559 | case self::OPT_FUNCTIONS_PARAMETERS_TYPE: |
1560 | 1560 | case self::OPT_PHPVALS_ENCODING_OPTIONS: |
1561 | 1561 | case self::OPT_RESPONSE_CHARSET_ENCODING: |
1562 | - $this->logDeprecation('Checking property Request::' . $name . ' is deprecated'); |
|
1562 | + $this->logDeprecation('Checking property Request::'.$name.' is deprecated'); |
|
1563 | 1563 | return isset($this->$name); |
1564 | 1564 | case 'accepted_charset_encodings': |
1565 | 1565 | // manually implement the 'protected property' behaviour |
@@ -1571,7 +1571,7 @@ discard block |
||
1571 | 1571 | } |
1572 | 1572 | } |
1573 | 1573 | if ($canAccess) { |
1574 | - $this->logDeprecation('Checking property Request::' . $name . ' is deprecated'); |
|
1574 | + $this->logDeprecation('Checking property Request::'.$name.' is deprecated'); |
|
1575 | 1575 | return isset($this->accepted_compression); |
1576 | 1576 | } |
1577 | 1577 | // break through voluntarily |
@@ -1591,7 +1591,7 @@ discard block |
||
1591 | 1591 | case self::OPT_FUNCTIONS_PARAMETERS_TYPE: |
1592 | 1592 | case self::OPT_PHPVALS_ENCODING_OPTIONS: |
1593 | 1593 | case self::OPT_RESPONSE_CHARSET_ENCODING: |
1594 | - $this->logDeprecation('Unsetting property Request::' . $name . ' is deprecated'); |
|
1594 | + $this->logDeprecation('Unsetting property Request::'.$name.' is deprecated'); |
|
1595 | 1595 | unset($this->$name); |
1596 | 1596 | break; |
1597 | 1597 | case 'accepted_charset_encodings': |
@@ -1604,16 +1604,16 @@ discard block |
||
1604 | 1604 | } |
1605 | 1605 | } |
1606 | 1606 | if ($canAccess) { |
1607 | - $this->logDeprecation('Unsetting property Request::' . $name . ' is deprecated'); |
|
1607 | + $this->logDeprecation('Unsetting property Request::'.$name.' is deprecated'); |
|
1608 | 1608 | unset($this->accepted_compression); |
1609 | 1609 | } else { |
1610 | - trigger_error("Cannot access protected property Server::accepted_charset_encodings in " . __FILE__, E_USER_ERROR); |
|
1610 | + trigger_error("Cannot access protected property Server::accepted_charset_encodings in ".__FILE__, E_USER_ERROR); |
|
1611 | 1611 | } |
1612 | 1612 | break; |
1613 | 1613 | default: |
1614 | 1614 | /// @todo throw instead? There are very few other places where the lib trigger errors which can potentially reach stdout... |
1615 | 1615 | $trace = debug_backtrace(DEBUG_BACKTRACE_IGNORE_ARGS, 1); |
1616 | - trigger_error('Undefined property via __unset(): ' . $name . ' in ' . $trace[0]['file'] . ' on line ' . $trace[0]['line'], E_USER_WARNING); |
|
1616 | + trigger_error('Undefined property via __unset(): '.$name.' in '.$trace[0]['file'].' on line '.$trace[0]['line'], E_USER_WARNING); |
|
1617 | 1617 | } |
1618 | 1618 | } |
1619 | 1619 | } |
@@ -19,9 +19,9 @@ discard block |
||
19 | 19 | use PhpXmlRpc\Encoder; |
20 | 20 | |
21 | 21 | /// @todo allow autoloading when the library is installed as dependency |
22 | -include_once __DIR__ . '/../vendor/autoload.php'; |
|
22 | +include_once __DIR__.'/../vendor/autoload.php'; |
|
23 | 23 | |
24 | -include __DIR__ . '/../tests/parse_args.php'; |
|
24 | +include __DIR__.'/../tests/parse_args.php'; |
|
25 | 25 | $args = argParser::getArgs(); |
26 | 26 | |
27 | 27 | function begin_test($test_name, $test_case) |
@@ -41,7 +41,7 @@ discard block |
||
41 | 41 | if (!isset($test_results[$test_name][$test_case])) { |
42 | 42 | trigger_error('ending test that was not started'); |
43 | 43 | } |
44 | - $test_results[$test_name][$test_case]['time'] = $end - $test_results[$test_name][$test_case]['time']; |
|
44 | + $test_results[$test_name][$test_case]['time'] = $end-$test_results[$test_name][$test_case]['time']; |
|
45 | 45 | $test_results[$test_name][$test_case]['result'] = $test_result; |
46 | 46 | echo '.'; |
47 | 47 | flush(); |
@@ -75,24 +75,24 @@ discard block |
||
75 | 75 | } |
76 | 76 | |
77 | 77 | if ($is_web) { |
78 | - echo "<h3>Using lib version: " . PhpXmlRpc::$xmlrpcVersion . " on PHP version: " . phpversion() . "</h3>\n"; |
|
78 | + echo "<h3>Using lib version: ".PhpXmlRpc::$xmlrpcVersion." on PHP version: ".phpversion()."</h3>\n"; |
|
79 | 79 | if ($xd) { |
80 | - echo "<h4>XDEBUG profiling enabled: skipping remote tests. Trace file is: " . htmlspecialchars(xdebug_get_profiler_filename()) . "</h4>\n"; |
|
80 | + echo "<h4>XDEBUG profiling enabled: skipping remote tests. Trace file is: ".htmlspecialchars(xdebug_get_profiler_filename())."</h4>\n"; |
|
81 | 81 | } |
82 | 82 | flush(); |
83 | 83 | ob_flush(); |
84 | 84 | } else { |
85 | - echo "Using lib version: " . PhpXmlRpc::$xmlrpcVersion . " on PHP version: " . phpversion() . "\n"; |
|
85 | + echo "Using lib version: ".PhpXmlRpc::$xmlrpcVersion." on PHP version: ".phpversion()."\n"; |
|
86 | 86 | if ($xd) { |
87 | - echo "XDEBUG profiling enabled: skipping remote tests\nTrace file is: " . xdebug_get_profiler_filename() . "\n"; |
|
87 | + echo "XDEBUG profiling enabled: skipping remote tests\nTrace file is: ".xdebug_get_profiler_filename()."\n"; |
|
88 | 88 | } |
89 | 89 | } |
90 | 90 | |
91 | 91 | // test 'manual style' data encoding vs. 'automatic style' encoding |
92 | 92 | begin_test('Data encoding (large array)', 'manual encoding'); |
93 | -for ($i = 0; $i < $num_tests; $i++) { |
|
93 | +for ($i = 0; $i<$num_tests; $i++) { |
|
94 | 94 | $vals = array(); |
95 | - for ($j = 0; $j < 10; $j++) { |
|
95 | + for ($j = 0; $j<10; $j++) { |
|
96 | 96 | $valArray = array(); |
97 | 97 | foreach ($data[$j] as $key => $val) { |
98 | 98 | $values = array(); |
@@ -117,7 +117,7 @@ discard block |
||
117 | 117 | |
118 | 118 | begin_test('Data encoding (large array)', 'automatic encoding'); |
119 | 119 | $encoder = new Encoder(); |
120 | -for ($i = 0; $i < $num_tests; $i++) { |
|
120 | +for ($i = 0; $i<$num_tests; $i++) { |
|
121 | 121 | $value = $encoder->encode($data, array('auto_dates')); |
122 | 122 | $out = $value->serialize(); |
123 | 123 | } |
@@ -125,8 +125,8 @@ discard block |
||
125 | 125 | |
126 | 126 | if (function_exists('xmlrpc_set_type')) { |
127 | 127 | begin_test('Data encoding (large array)', 'xmlrpc-epi encoding'); |
128 | - for ($i = 0; $i < $num_tests; $i++) { |
|
129 | - for ($j = 0; $j < 10; $j++) { |
|
128 | + for ($i = 0; $i<$num_tests; $i++) { |
|
129 | + for ($j = 0; $j<10; $j++) { |
|
130 | 130 | foreach ($keys as $k) { |
131 | 131 | xmlrpc_set_type($data[$j][$k][4], 'datetime'); |
132 | 132 | xmlrpc_set_type($data[$j][$k][8], 'datetime'); |
@@ -140,18 +140,18 @@ discard block |
||
140 | 140 | // test 'old style' data decoding vs. 'automatic style' decoding |
141 | 141 | $dummy = new Request(''); |
142 | 142 | $out = new Response($data); |
143 | -$in = '<?xml version="1.0" ?>' . "\n" . $out->serialize(); |
|
143 | +$in = '<?xml version="1.0" ?>'."\n".$out->serialize(); |
|
144 | 144 | |
145 | 145 | begin_test('Data decoding (large array)', 'manual decoding'); |
146 | -for ($i = 0; $i < $num_tests; $i++) { |
|
146 | +for ($i = 0; $i<$num_tests; $i++) { |
|
147 | 147 | $response = $dummy->parseResponse($in, true); |
148 | 148 | $value = $response->value(); |
149 | 149 | $result = array(); |
150 | - foreach($value as $val1) { |
|
150 | + foreach ($value as $val1) { |
|
151 | 151 | $out = array(); |
152 | - foreach($val1 as $name => $val) { |
|
152 | + foreach ($val1 as $name => $val) { |
|
153 | 153 | $out[$name] = array(); |
154 | - foreach($val as $data) { |
|
154 | + foreach ($val as $data) { |
|
155 | 155 | $out[$name][] = $data->scalarVal(); |
156 | 156 | } |
157 | 157 | } |
@@ -161,18 +161,18 @@ discard block |
||
161 | 161 | end_test('Data decoding (large array)', 'manual decoding', $result); |
162 | 162 | |
163 | 163 | begin_test('Data decoding (large array)', 'manual decoding deprecated'); |
164 | -for ($i = 0; $i < $num_tests; $i++) { |
|
164 | +for ($i = 0; $i<$num_tests; $i++) { |
|
165 | 165 | $response = $dummy->ParseResponse($in, true); |
166 | 166 | $value = $response->value(); |
167 | 167 | $result = array(); |
168 | 168 | $l = $value->arraySize(); |
169 | - for ($k = 0; $k < $l; $k++) { |
|
169 | + for ($k = 0; $k<$l; $k++) { |
|
170 | 170 | $val1 = $value->arrayMem($k); |
171 | 171 | $out = array(); |
172 | - foreach($val1 as $name => $val) { |
|
172 | + foreach ($val1 as $name => $val) { |
|
173 | 173 | $out[$name] = array(); |
174 | 174 | $m = $val->arraySize(); |
175 | - for ($j = 0; $j < $m; $j++) { |
|
175 | + for ($j = 0; $j<$m; $j++) { |
|
176 | 176 | $data = $val->arrayMem($j); |
177 | 177 | $out[$name][] = $data->scalarVal(); |
178 | 178 | } |
@@ -183,7 +183,7 @@ discard block |
||
183 | 183 | end_test('Data decoding (large array)', 'manual decoding deprecated', $result); |
184 | 184 | |
185 | 185 | begin_test('Data decoding (large array)', 'automatic decoding'); |
186 | -for ($i = 0; $i < $num_tests; $i++) { |
|
186 | +for ($i = 0; $i<$num_tests; $i++) { |
|
187 | 187 | $response = $dummy->parseResponse($in, true, 'phpvals'); |
188 | 188 | $value = $response->value(); |
189 | 189 | } |
@@ -191,7 +191,7 @@ discard block |
||
191 | 191 | |
192 | 192 | if (function_exists('xmlrpc_decode')) { |
193 | 193 | begin_test('Data decoding (large array)', 'xmlrpc-epi decoding'); |
194 | - for ($i = 0; $i < $num_tests; $i++) { |
|
194 | + for ($i = 0; $i<$num_tests; $i++) { |
|
195 | 195 | $response = $dummy->parseResponse($in, true, 'xml'); |
196 | 196 | $value = xmlrpc_decode($response->value()); |
197 | 197 | } |
@@ -208,16 +208,16 @@ discard block |
||
208 | 208 | $value = $encoder->encode($data1, array('auto_dates')); |
209 | 209 | $req = new Request('interopEchoTests.echoValue', array($value)); |
210 | 210 | $reqs = array(); |
211 | - for ($i = 0; $i < $num_tests; $i++) { |
|
211 | + for ($i = 0; $i<$num_tests; $i++) { |
|
212 | 212 | $reqs[] = $req; |
213 | 213 | } |
214 | 214 | |
215 | 215 | $server = explode(':', $args['HTTPSERVER']); |
216 | - if (count($server) > 1) { |
|
217 | - $srv = 'http://' . $server[0] . '://' . $server[1] . $args['HTTPURI']; |
|
216 | + if (count($server)>1) { |
|
217 | + $srv = 'http://'.$server[0].'://'.$server[1].$args['HTTPURI']; |
|
218 | 218 | $c = new Client($args['HTTPURI'], $server[0], $server[1]); |
219 | 219 | } else { |
220 | - $srv = 'http://' . $args['HTTPSERVER'] . $args['HTTPURI']; |
|
220 | + $srv = 'http://'.$args['HTTPSERVER'].$args['HTTPURI']; |
|
221 | 221 | $c = new Client($args['HTTPURI'], $args['HTTPSERVER']); |
222 | 222 | } |
223 | 223 | |
@@ -229,7 +229,7 @@ discard block |
||
229 | 229 | |
230 | 230 | begin_test($testName, 'http 10'); |
231 | 231 | $response = array(); |
232 | - for ($i = 0; $i < $num_tests; $i++) { |
|
232 | + for ($i = 0; $i<$num_tests; $i++) { |
|
233 | 233 | $resp = $c->send($req); |
234 | 234 | $response[] = $resp->value(); |
235 | 235 | } |
@@ -239,7 +239,7 @@ discard block |
||
239 | 239 | $c->setOption(Client::OPT_KEEPALIVE, false); |
240 | 240 | begin_test($testName, 'http 11 no keepalive'); |
241 | 241 | $response = array(); |
242 | - for ($i = 0; $i < $num_tests; $i++) { |
|
242 | + for ($i = 0; $i<$num_tests; $i++) { |
|
243 | 243 | $resp = $c->send($req, 10, 'http11'); |
244 | 244 | $response[] = $resp->value(); |
245 | 245 | } |
@@ -247,7 +247,7 @@ discard block |
||
247 | 247 | |
248 | 248 | begin_test($testName, 'http 11 w. keep-alive'); |
249 | 249 | $response = array(); |
250 | - for ($i = 0; $i < $num_tests; $i++) { |
|
250 | + for ($i = 0; $i<$num_tests; $i++) { |
|
251 | 251 | $resp = $c->send($req, 10, 'http11'); |
252 | 252 | $response[] = $resp->value(); |
253 | 253 | } |
@@ -269,7 +269,7 @@ discard block |
||
269 | 269 | |
270 | 270 | begin_test($testName, 'http 10 w. compression'); |
271 | 271 | $response = array(); |
272 | - for ($i = 0; $i < $num_tests; $i++) { |
|
272 | + for ($i = 0; $i<$num_tests; $i++) { |
|
273 | 273 | $resp = $c->send($req); |
274 | 274 | $response[] = $resp->value(); |
275 | 275 | } |
@@ -279,7 +279,7 @@ discard block |
||
279 | 279 | $c->setOption(Client::OPT_KEEPALIVE, false); |
280 | 280 | begin_test($testName, 'http 11 w. compression and no keepalive'); |
281 | 281 | $response = array(); |
282 | - for ($i = 0; $i < $num_tests; $i++) { |
|
282 | + for ($i = 0; $i<$num_tests; $i++) { |
|
283 | 283 | $resp = $c->send($req, 10, 'http11'); |
284 | 284 | $response[] = $resp->value(); |
285 | 285 | } |
@@ -288,7 +288,7 @@ discard block |
||
288 | 288 | $c->setOption(Client::OPT_KEEPALIVE, true); |
289 | 289 | begin_test($testName, 'http 11 w. keep-alive and compression'); |
290 | 290 | $response = array(); |
291 | - for ($i = 0; $i < $num_tests; $i++) { |
|
291 | + for ($i = 0; $i<$num_tests; $i++) { |
|
292 | 292 | $resp = $c->send($req, 10, 'http11'); |
293 | 293 | $response[] = $resp->value(); |
294 | 294 | } |
@@ -309,11 +309,11 @@ discard block |
||
309 | 309 | /// test multicall vs. many calls vs. keep-alives - HTTPS |
310 | 310 | |
311 | 311 | $server = explode(':', $args['HTTPSSERVER']); |
312 | - if (count($server) > 1) { |
|
313 | - $srv = 'https://' . $server[0] . ':' . $server[1] . $args['HTTPSURI']; |
|
312 | + if (count($server)>1) { |
|
313 | + $srv = 'https://'.$server[0].':'.$server[1].$args['HTTPSURI']; |
|
314 | 314 | $c = new Client($args['HTTPSURI'], $server[0], $server[1], 'https'); |
315 | 315 | } else { |
316 | - $srv = 'https://' . $args['HTTPSSERVER'] . $args['HTTPSURI']; |
|
316 | + $srv = 'https://'.$args['HTTPSSERVER'].$args['HTTPSURI']; |
|
317 | 317 | $c = new Client($args['HTTPSURI'], $args['HTTPSSERVER'], 443, 'https'); |
318 | 318 | } |
319 | 319 | $c->setOption(Client::OPT_VERIFY_PEER, !$args['HTTPSIGNOREPEER']); |
@@ -327,7 +327,7 @@ discard block |
||
327 | 327 | $c->setOption(Client::OPT_KEEPALIVE, false); |
328 | 328 | begin_test($testName, 'https no keep-alive'); |
329 | 329 | $response = array(); |
330 | - for ($i = 0; $i < $num_tests; $i++) { |
|
330 | + for ($i = 0; $i<$num_tests; $i++) { |
|
331 | 331 | $resp = $c->send($req); |
332 | 332 | $response[] = $resp->value(); |
333 | 333 | } |
@@ -336,7 +336,7 @@ discard block |
||
336 | 336 | $c->setOption(Client::OPT_KEEPALIVE, true); |
337 | 337 | begin_test($testName, 'https w. keep-alive'); |
338 | 338 | $response = array(); |
339 | - for ($i = 0; $i < $num_tests; $i++) { |
|
339 | + for ($i = 0; $i<$num_tests; $i++) { |
|
340 | 340 | $resp = $c->send($req, 10); |
341 | 341 | $response[] = $resp->value(); |
342 | 342 | } |
@@ -357,7 +357,7 @@ discard block |
||
357 | 357 | $c->setOption(Client::OPT_KEEPALIVE, false); |
358 | 358 | begin_test($testName, 'https w. compression and no keepalive'); |
359 | 359 | $response = array(); |
360 | - for ($i = 0; $i < $num_tests; $i++) { |
|
360 | + for ($i = 0; $i<$num_tests; $i++) { |
|
361 | 361 | $resp = $c->send($req); |
362 | 362 | $response[] = $resp->value(); |
363 | 363 | } |
@@ -366,7 +366,7 @@ discard block |
||
366 | 366 | $c->setOption(Client::OPT_KEEPALIVE, true); |
367 | 367 | begin_test($testName, 'https w. keep-alive and compression'); |
368 | 368 | $response = array(); |
369 | - for ($i = 0; $i < $num_tests; $i++) { |
|
369 | + for ($i = 0; $i<$num_tests; $i++) { |
|
370 | 370 | $resp = $c->send($req, 10); |
371 | 371 | $response[] = $resp->value(); |
372 | 372 | } |
@@ -387,11 +387,11 @@ discard block |
||
387 | 387 | /// test multicall vs. many calls vs. keep-alives - HTTP/2 |
388 | 388 | |
389 | 389 | $server = explode(':', $args['HTTPSSERVER']); |
390 | - if (count($server) > 1) { |
|
391 | - $srv = 'https://' . $server[0] . ':' . $server[1] . $args['HTTPSURI']; |
|
390 | + if (count($server)>1) { |
|
391 | + $srv = 'https://'.$server[0].':'.$server[1].$args['HTTPSURI']; |
|
392 | 392 | $c = new Client($args['HTTPSURI'], $server[0], $server[1], 'https'); |
393 | 393 | } else { |
394 | - $srv = 'https://' . $args['HTTPSSERVER'] . $args['HTTPSURI']; |
|
394 | + $srv = 'https://'.$args['HTTPSSERVER'].$args['HTTPSURI']; |
|
395 | 395 | $c = new Client($args['HTTPSURI'], $args['HTTPSSERVER'], 443, 'h2'); |
396 | 396 | } |
397 | 397 | $c->setOption(Client::OPT_VERIFY_PEER, !$args['HTTPSIGNOREPEER']); |
@@ -405,7 +405,7 @@ discard block |
||
405 | 405 | $c->setOption(Client::OPT_KEEPALIVE, false); |
406 | 406 | begin_test($testName, 'http2 no keep-alive'); |
407 | 407 | $response = array(); |
408 | - for ($i = 0; $i < $num_tests; $i++) { |
|
408 | + for ($i = 0; $i<$num_tests; $i++) { |
|
409 | 409 | $resp = $c->send($req); |
410 | 410 | $response[] = $resp->value(); |
411 | 411 | } |
@@ -414,7 +414,7 @@ discard block |
||
414 | 414 | $c->setOption(Client::OPT_KEEPALIVE, true); |
415 | 415 | begin_test($testName, 'http2 w. keep-alive'); |
416 | 416 | $response = array(); |
417 | - for ($i = 0; $i < $num_tests; $i++) { |
|
417 | + for ($i = 0; $i<$num_tests; $i++) { |
|
418 | 418 | $resp = $c->send($req, 10); |
419 | 419 | $response[] = $resp->value(); |
420 | 420 | } |
@@ -435,7 +435,7 @@ discard block |
||
435 | 435 | $c->setOption(Client::OPT_KEEPALIVE, false); |
436 | 436 | begin_test($testName, 'http2 w. compression and no keepalive'); |
437 | 437 | $response = array(); |
438 | - for ($i = 0; $i < $num_tests; $i++) { |
|
438 | + for ($i = 0; $i<$num_tests; $i++) { |
|
439 | 439 | $resp = $c->send($req); |
440 | 440 | $response[] = $resp->value(); |
441 | 441 | } |
@@ -444,7 +444,7 @@ discard block |
||
444 | 444 | $c->setOption(Client::OPT_KEEPALIVE, true); |
445 | 445 | begin_test($testName, 'http2 w. keep-alive and compression'); |
446 | 446 | $response = array(); |
447 | - for ($i = 0; $i < $num_tests; $i++) { |
|
447 | + for ($i = 0; $i<$num_tests; $i++) { |
|
448 | 448 | $resp = $c->send($req, 10); |
449 | 449 | $response[] = $resp->value(); |
450 | 450 | } |
@@ -466,7 +466,7 @@ discard block |
||
466 | 466 | foreach ($test_results as $test => $results) { |
467 | 467 | echo "\nTEST: $test\n"; |
468 | 468 | foreach ($results as $case => $data) { |
469 | - echo " $case: {$data['time']} secs - Output data CRC: " . crc32(serialize($data['result'])) . "\n"; |
|
469 | + echo " $case: {$data['time']} secs - Output data CRC: ".crc32(serialize($data['result']))."\n"; |
|
470 | 470 | } |
471 | 471 | } |
472 | 472 |