@@ -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,21 +225,21 @@ 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 | // Do not create response serialization if it has already happened. Helps building json magic |
239 | 239 | if (empty($r->payload)) { |
240 | 240 | $r->serialize($respCharset); |
241 | 241 | } |
242 | - $payload = $payload . $r->payload; |
|
242 | + $payload = $payload.$r->payload; |
|
243 | 243 | |
244 | 244 | if ($returnPayload) { |
245 | 245 | return $payload; |
@@ -248,7 +248,7 @@ discard block |
||
248 | 248 | // if we get a warning/error that has output some text before here, then we cannot |
249 | 249 | // add a new header. We cannot say we are sending xml, either... |
250 | 250 | if (!headers_sent()) { |
251 | - header('Content-Type: ' . $r->content_type); |
|
251 | + header('Content-Type: '.$r->content_type); |
|
252 | 252 | // we do not know if client actually told us an accepted charset, but if he did |
253 | 253 | // we have to tell him what we did |
254 | 254 | header("Vary: Accept-Charset"); |
@@ -274,10 +274,10 @@ discard block |
||
274 | 274 | // do not output content-length header if php is compressing output for us: |
275 | 275 | // it will mess up measurements |
276 | 276 | if ($phpNoSelfCompress) { |
277 | - header('Content-Length: ' . (int)strlen($payload)); |
|
277 | + header('Content-Length: '.(int) strlen($payload)); |
|
278 | 278 | } |
279 | 279 | } else { |
280 | - error_log('XML-RPC: ' . __METHOD__ . ': http headers already sent before response is fully generated. Check for php warning or error messages'); |
|
280 | + error_log('XML-RPC: '.__METHOD__.': http headers already sent before response is fully generated. Check for php warning or error messages'); |
|
281 | 281 | } |
282 | 282 | |
283 | 283 | print $payload; |
@@ -326,9 +326,9 @@ discard block |
||
326 | 326 | $numParams = count($in); |
327 | 327 | } |
328 | 328 | foreach ($sigs as $curSig) { |
329 | - if (count($curSig) == $numParams + 1) { |
|
329 | + if (count($curSig) == $numParams+1) { |
|
330 | 330 | $itsOK = 1; |
331 | - for ($n = 0; $n < $numParams; $n++) { |
|
331 | + for ($n = 0; $n<$numParams; $n++) { |
|
332 | 332 | if (is_object($in)) { |
333 | 333 | $p = $in->getParam($n); |
334 | 334 | if ($p->kindOf() == 'scalar') { |
@@ -341,10 +341,10 @@ discard block |
||
341 | 341 | } |
342 | 342 | |
343 | 343 | // param index is $n+1, as first member of sig is return type |
344 | - if ($pt != $curSig[$n + 1] && $curSig[$n + 1] != Value::$xmlrpcValue) { |
|
344 | + if ($pt != $curSig[$n+1] && $curSig[$n+1] != Value::$xmlrpcValue) { |
|
345 | 345 | $itsOK = 0; |
346 | - $pno = $n + 1; |
|
347 | - $wanted = $curSig[$n + 1]; |
|
346 | + $pno = $n+1; |
|
347 | + $wanted = $curSig[$n+1]; |
|
348 | 348 | $got = $pt; |
349 | 349 | break; |
350 | 350 | } |
@@ -371,10 +371,10 @@ discard block |
||
371 | 371 | // check if $_SERVER is populated: it might have been disabled via ini file |
372 | 372 | // (this is true even when in CLI mode) |
373 | 373 | if (count($_SERVER) == 0) { |
374 | - error_log('XML-RPC: ' . __METHOD__ . ': cannot parse request headers as $_SERVER is not populated'); |
|
374 | + error_log('XML-RPC: '.__METHOD__.': cannot parse request headers as $_SERVER is not populated'); |
|
375 | 375 | } |
376 | 376 | |
377 | - if ($this->debug > 1) { |
|
377 | + if ($this->debug>1) { |
|
378 | 378 | if (function_exists('getallheaders')) { |
379 | 379 | $this->debugmsg(''); // empty line |
380 | 380 | foreach (getallheaders() as $name => $val) { |
@@ -396,13 +396,13 @@ discard block |
||
396 | 396 | if (function_exists('gzinflate') && in_array($contentEncoding, $this->accepted_compression)) { |
397 | 397 | if ($contentEncoding == 'deflate' && $degzdata = @gzuncompress($data)) { |
398 | 398 | $data = $degzdata; |
399 | - if ($this->debug > 1) { |
|
400 | - $this->debugmsg("\n+++INFLATED REQUEST+++[" . strlen($data) . " chars]+++\n" . $data . "\n+++END+++"); |
|
399 | + if ($this->debug>1) { |
|
400 | + $this->debugmsg("\n+++INFLATED REQUEST+++[".strlen($data)." chars]+++\n".$data."\n+++END+++"); |
|
401 | 401 | } |
402 | 402 | } elseif ($contentEncoding == 'gzip' && $degzdata = @gzinflate(substr($data, 10))) { |
403 | 403 | $data = $degzdata; |
404 | - if ($this->debug > 1) { |
|
405 | - $this->debugmsg("+++INFLATED REQUEST+++[" . strlen($data) . " chars]+++\n" . $data . "\n+++END+++"); |
|
404 | + if ($this->debug>1) { |
|
405 | + $this->debugmsg("+++INFLATED REQUEST+++[".strlen($data)." chars]+++\n".$data."\n+++END+++"); |
|
406 | 406 | } |
407 | 407 | } else { |
408 | 408 | $r = new Response(0, PhpXmlRpc::$xmlrpcerr['server_decompress_fail'], PhpXmlRpc::$xmlrpcstr['server_decompress_fail']); |
@@ -486,7 +486,7 @@ discard block |
||
486 | 486 | if (extension_loaded('mbstring')) { |
487 | 487 | $data = mb_convert_encoding($data, 'UTF-8', $reqEncoding); |
488 | 488 | } else { |
489 | - error_log('XML-RPC: ' . __METHOD__ . ': invalid charset encoding of received request: ' . $reqEncoding); |
|
489 | + error_log('XML-RPC: '.__METHOD__.': invalid charset encoding of received request: '.$reqEncoding); |
|
490 | 490 | } |
491 | 491 | } |
492 | 492 | } |
@@ -504,16 +504,16 @@ discard block |
||
504 | 504 | |
505 | 505 | $xmlRpcParser = new XMLParser($options); |
506 | 506 | $xmlRpcParser->parse($data, $this->functions_parameters_type, XMLParser::ACCEPT_REQUEST); |
507 | - if ($xmlRpcParser->_xh['isf'] > 2) { |
|
507 | + if ($xmlRpcParser->_xh['isf']>2) { |
|
508 | 508 | // (BC) we return XML error as a faultCode |
509 | 509 | preg_match('/^XML error ([0-9]+)/', $xmlRpcParser->_xh['isf_reason'], $matches); |
510 | 510 | $r = new Response(0, |
511 | - PhpXmlRpc::$xmlrpcerrxml + $matches[1], |
|
511 | + PhpXmlRpc::$xmlrpcerrxml+$matches[1], |
|
512 | 512 | $xmlRpcParser->_xh['isf_reason']); |
513 | 513 | } elseif ($xmlRpcParser->_xh['isf']) { |
514 | 514 | $r = new Response(0, |
515 | 515 | PhpXmlRpc::$xmlrpcerr['invalid_request'], |
516 | - PhpXmlRpc::$xmlrpcstr['invalid_request'] . ' ' . $xmlRpcParser->_xh['isf_reason']); |
|
516 | + PhpXmlRpc::$xmlrpcstr['invalid_request'].' '.$xmlRpcParser->_xh['isf_reason']); |
|
517 | 517 | } else { |
518 | 518 | // small layering violation in favor of speed and memory usage: |
519 | 519 | // we should allow the 'execute' method handle this, but in the |
@@ -524,20 +524,20 @@ discard block |
||
524 | 524 | ($this->dmap[$xmlRpcParser->_xh['method']]['parameters_type'] == 'phpvals') |
525 | 525 | ) |
526 | 526 | ) { |
527 | - if ($this->debug > 1) { |
|
528 | - $this->debugmsg("\n+++PARSED+++\n" . var_export($xmlRpcParser->_xh['params'], true) . "\n+++END+++"); |
|
527 | + if ($this->debug>1) { |
|
528 | + $this->debugmsg("\n+++PARSED+++\n".var_export($xmlRpcParser->_xh['params'], true)."\n+++END+++"); |
|
529 | 529 | } |
530 | 530 | $r = $this->execute($xmlRpcParser->_xh['method'], $xmlRpcParser->_xh['params'], $xmlRpcParser->_xh['pt']); |
531 | 531 | } else { |
532 | 532 | // build a Request object with data parsed from xml |
533 | 533 | $req = new Request($xmlRpcParser->_xh['method']); |
534 | 534 | // now add parameters in |
535 | - for ($i = 0; $i < count($xmlRpcParser->_xh['params']); $i++) { |
|
535 | + for ($i = 0; $i<count($xmlRpcParser->_xh['params']); $i++) { |
|
536 | 536 | $req->addParam($xmlRpcParser->_xh['params'][$i]); |
537 | 537 | } |
538 | 538 | |
539 | - if ($this->debug > 1) { |
|
540 | - $this->debugmsg("\n+++PARSED+++\n" . var_export($req, true) . "\n+++END+++"); |
|
539 | + if ($this->debug>1) { |
|
540 | + $this->debugmsg("\n+++PARSED+++\n".var_export($req, true)."\n+++END+++"); |
|
541 | 541 | } |
542 | 542 | $r = $this->execute($req); |
543 | 543 | } |
@@ -590,7 +590,7 @@ discard block |
||
590 | 590 | return new Response( |
591 | 591 | 0, |
592 | 592 | PhpXmlRpc::$xmlrpcerr['incorrect_params'], |
593 | - PhpXmlRpc::$xmlrpcstr['incorrect_params'] . ": ${errStr}" |
|
593 | + PhpXmlRpc::$xmlrpcstr['incorrect_params'].": ${errStr}" |
|
594 | 594 | ); |
595 | 595 | } |
596 | 596 | } |
@@ -603,7 +603,7 @@ discard block |
||
603 | 603 | |
604 | 604 | if (is_array($func)) { |
605 | 605 | if (is_object($func[0])) { |
606 | - $funcName = get_class($func[0]) . '->' . $func[1]; |
|
606 | + $funcName = get_class($func[0]).'->'.$func[1]; |
|
607 | 607 | } else { |
608 | 608 | $funcName = implode('::', $func); |
609 | 609 | } |
@@ -615,17 +615,17 @@ discard block |
||
615 | 615 | |
616 | 616 | // verify that function to be invoked is in fact callable |
617 | 617 | if (!is_callable($func)) { |
618 | - error_log("XML-RPC: " . __METHOD__ . ": function '$funcName' registered as method handler is not callable"); |
|
618 | + error_log("XML-RPC: ".__METHOD__.": function '$funcName' registered as method handler is not callable"); |
|
619 | 619 | return new Response( |
620 | 620 | 0, |
621 | 621 | PhpXmlRpc::$xmlrpcerr['server_error'], |
622 | - PhpXmlRpc::$xmlrpcstr['server_error'] . ": no function matches method" |
|
622 | + PhpXmlRpc::$xmlrpcstr['server_error'].": no function matches method" |
|
623 | 623 | ); |
624 | 624 | } |
625 | 625 | |
626 | 626 | // If debug level is 3, we should catch all errors generated during |
627 | 627 | // processing of user function, and log them as part of response |
628 | - if ($this->debug > 2) { |
|
628 | + if ($this->debug>2) { |
|
629 | 629 | self::$_xmlrpcs_prev_ehandler = set_error_handler(array('\PhpXmlRpc\Server', '_xmlrpcs_errorHandler')); |
630 | 630 | } |
631 | 631 | |
@@ -638,14 +638,14 @@ discard block |
||
638 | 638 | $r = call_user_func($func, $req); |
639 | 639 | } |
640 | 640 | if (!is_a($r, 'PhpXmlRpc\Response')) { |
641 | - error_log("XML-RPC: " . __METHOD__ . ": function '$funcName' registered as method handler does not return an xmlrpc response object but a " . gettype($r)); |
|
641 | + error_log("XML-RPC: ".__METHOD__.": function '$funcName' registered as method handler does not return an xmlrpc response object but a ".gettype($r)); |
|
642 | 642 | if (is_a($r, 'PhpXmlRpc\Value')) { |
643 | 643 | $r = new Response($r); |
644 | 644 | } else { |
645 | 645 | $r = new Response( |
646 | 646 | 0, |
647 | 647 | PhpXmlRpc::$xmlrpcerr['server_error'], |
648 | - PhpXmlRpc::$xmlrpcstr['server_error'] . ": function does not return xmlrpc response object" |
|
648 | + PhpXmlRpc::$xmlrpcstr['server_error'].": function does not return xmlrpc response object" |
|
649 | 649 | ); |
650 | 650 | } |
651 | 651 | } |
@@ -661,7 +661,7 @@ discard block |
||
661 | 661 | // mimic EPI behaviour: if we get an array that looks like an error, make it |
662 | 662 | // an eror response |
663 | 663 | if (is_array($r) && array_key_exists('faultCode', $r) && array_key_exists('faultString', $r)) { |
664 | - $r = new Response(0, (integer)$r['faultCode'], (string)$r['faultString']); |
|
664 | + $r = new Response(0, (integer) $r['faultCode'], (string) $r['faultString']); |
|
665 | 665 | } else { |
666 | 666 | // functions using EPI api should NOT return resp objects, |
667 | 667 | // so make sure we encode the return type correctly |
@@ -685,7 +685,7 @@ discard block |
||
685 | 685 | // in the called function, we wrap it in a proper error-response |
686 | 686 | switch ($this->exception_handling) { |
687 | 687 | case 2: |
688 | - if ($this->debug > 2) { |
|
688 | + if ($this->debug>2) { |
|
689 | 689 | if (self::$_xmlrpcs_prev_ehandler) { |
690 | 690 | set_error_handler(self::$_xmlrpcs_prev_ehandler); |
691 | 691 | } else { |
@@ -701,7 +701,7 @@ discard block |
||
701 | 701 | $r = new Response(0, PhpXmlRpc::$xmlrpcerr['server_error'], PhpXmlRpc::$xmlrpcstr['server_error']); |
702 | 702 | } |
703 | 703 | } |
704 | - if ($this->debug > 2) { |
|
704 | + if ($this->debug>2) { |
|
705 | 705 | // note: restore the error handler we found before calling the |
706 | 706 | // user func, even if it has been changed inside the func itself |
707 | 707 | if (self::$_xmlrpcs_prev_ehandler) { |
@@ -721,7 +721,7 @@ discard block |
||
721 | 721 | */ |
722 | 722 | protected function debugmsg($string) |
723 | 723 | { |
724 | - $this->debug_info .= $string . "\n"; |
|
724 | + $this->debug_info .= $string."\n"; |
|
725 | 725 | } |
726 | 726 | |
727 | 727 | /** |
@@ -731,9 +731,9 @@ discard block |
||
731 | 731 | protected function xml_header($charsetEncoding = '') |
732 | 732 | { |
733 | 733 | if ($charsetEncoding != '') { |
734 | - return "<?xml version=\"1.0\" encoding=\"$charsetEncoding\"?" . ">\n"; |
|
734 | + return "<?xml version=\"1.0\" encoding=\"$charsetEncoding\"?".">\n"; |
|
735 | 735 | } else { |
736 | - return "<?xml version=\"1.0\"?" . ">\n"; |
|
736 | + return "<?xml version=\"1.0\"?".">\n"; |
|
737 | 737 | } |
738 | 738 | } |
739 | 739 | |
@@ -966,12 +966,12 @@ discard block |
||
966 | 966 | } |
967 | 967 | |
968 | 968 | $req = new Request($methName->scalarval()); |
969 | - foreach($params as $i => $param) { |
|
969 | + foreach ($params as $i => $param) { |
|
970 | 970 | if (!$req->addParam($param)) { |
971 | 971 | $i++; // for error message, we count params from 1 |
972 | 972 | return static::_xmlrpcs_multicall_error(new Response(0, |
973 | 973 | PhpXmlRpc::$xmlrpcerr['incorrect_params'], |
974 | - PhpXmlRpc::$xmlrpcstr['incorrect_params'] . ": probable xml error in param " . $i)); |
|
974 | + PhpXmlRpc::$xmlrpcstr['incorrect_params'].": probable xml error in param ".$i)); |
|
975 | 975 | } |
976 | 976 | } |
977 | 977 | |
@@ -1038,12 +1038,12 @@ discard block |
||
1038 | 1038 | // let accept a plain list of php parameters, beside a single xmlrpc msg object |
1039 | 1039 | if (is_object($req)) { |
1040 | 1040 | $calls = $req->getParam(0); |
1041 | - foreach($calls as $call) { |
|
1041 | + foreach ($calls as $call) { |
|
1042 | 1042 | $result[] = static::_xmlrpcs_multicall_do_call($server, $call); |
1043 | 1043 | } |
1044 | 1044 | } else { |
1045 | 1045 | $numCalls = count($req); |
1046 | - for ($i = 0; $i < $numCalls; $i++) { |
|
1046 | + for ($i = 0; $i<$numCalls; $i++) { |
|
1047 | 1047 | $result[$i] = static::_xmlrpcs_multicall_do_call_phpvals($server, $req[$i]); |
1048 | 1048 | } |
1049 | 1049 | } |
@@ -117,35 +117,35 @@ |
||
117 | 117 | public function serialize($charsetEncoding = '') |
118 | 118 | { |
119 | 119 | if ($charsetEncoding != '') { |
120 | - $this->content_type = 'text/xml; charset=' . $charsetEncoding; |
|
120 | + $this->content_type = 'text/xml; charset='.$charsetEncoding; |
|
121 | 121 | } else { |
122 | 122 | $this->content_type = 'text/xml'; |
123 | 123 | } |
124 | 124 | if (PhpXmlRpc::$xmlrpc_null_apache_encoding) { |
125 | - $result = "<methodResponse xmlns:ex=\"" . PhpXmlRpc::$xmlrpc_null_apache_encoding_ns . "\">\n"; |
|
125 | + $result = "<methodResponse xmlns:ex=\"".PhpXmlRpc::$xmlrpc_null_apache_encoding_ns."\">\n"; |
|
126 | 126 | } else { |
127 | 127 | $result = "<methodResponse>\n"; |
128 | 128 | } |
129 | 129 | if ($this->errno) { |
130 | 130 | // Let non-ASCII response messages be tolerated by clients by xml-encoding non ascii chars |
131 | - $result .= "<fault>\n" . |
|
132 | - "<value>\n<struct><member><name>faultCode</name>\n<value><int>" . $this->errno . |
|
133 | - "</int></value>\n</member>\n<member>\n<name>faultString</name>\n<value><string>" . |
|
134 | - Charset::instance()->encodeEntities($this->errstr, PhpXmlRpc::$xmlrpc_internalencoding, $charsetEncoding) . "</string></value>\n</member>\n" . |
|
131 | + $result .= "<fault>\n". |
|
132 | + "<value>\n<struct><member><name>faultCode</name>\n<value><int>".$this->errno. |
|
133 | + "</int></value>\n</member>\n<member>\n<name>faultString</name>\n<value><string>". |
|
134 | + Charset::instance()->encodeEntities($this->errstr, PhpXmlRpc::$xmlrpc_internalencoding, $charsetEncoding)."</string></value>\n</member>\n". |
|
135 | 135 | "</struct>\n</value>\n</fault>"; |
136 | 136 | } else { |
137 | 137 | if (!is_object($this->val) || !is_a($this->val, 'PhpXmlRpc\Value')) { |
138 | 138 | if (is_string($this->val) && $this->valtyp == 'xml') { |
139 | - $result .= "<params>\n<param>\n" . |
|
140 | - $this->val . |
|
139 | + $result .= "<params>\n<param>\n". |
|
140 | + $this->val. |
|
141 | 141 | "</param>\n</params>"; |
142 | 142 | } else { |
143 | 143 | /// @todo try to build something serializable? |
144 | 144 | throw new \Exception('cannot serialize xmlrpc response objects whose content is native php values'); |
145 | 145 | } |
146 | 146 | } else { |
147 | - $result .= "<params>\n<param>\n" . |
|
148 | - $this->val->serialize($charsetEncoding) . |
|
147 | + $result .= "<params>\n<param>\n". |
|
148 | + $this->val->serialize($charsetEncoding). |
|
149 | 149 | "</param>\n</params>"; |
150 | 150 | } |
151 | 151 | } |
@@ -83,7 +83,7 @@ discard block |
||
83 | 83 | $this->me['struct'] = $val; |
84 | 84 | break; |
85 | 85 | default: |
86 | - error_log("XML-RPC: " . __METHOD__ . ": not a known type ($type)"); |
|
86 | + error_log("XML-RPC: ".__METHOD__.": not a known type ($type)"); |
|
87 | 87 | } |
88 | 88 | } |
89 | 89 | } |
@@ -108,7 +108,7 @@ discard block |
||
108 | 108 | } |
109 | 109 | |
110 | 110 | if ($typeOf !== 1) { |
111 | - error_log("XML-RPC: " . __METHOD__ . ": not a scalar type ($type)"); |
|
111 | + error_log("XML-RPC: ".__METHOD__.": not a scalar type ($type)"); |
|
112 | 112 | return 0; |
113 | 113 | } |
114 | 114 | |
@@ -125,10 +125,10 @@ discard block |
||
125 | 125 | |
126 | 126 | switch ($this->mytype) { |
127 | 127 | case 1: |
128 | - error_log('XML-RPC: ' . __METHOD__ . ': scalar xmlrpc value can have only one value'); |
|
128 | + error_log('XML-RPC: '.__METHOD__.': scalar xmlrpc value can have only one value'); |
|
129 | 129 | return 0; |
130 | 130 | case 3: |
131 | - error_log('XML-RPC: ' . __METHOD__ . ': cannot add anonymous scalar to struct xmlrpc value'); |
|
131 | + error_log('XML-RPC: '.__METHOD__.': cannot add anonymous scalar to struct xmlrpc value'); |
|
132 | 132 | return 0; |
133 | 133 | case 2: |
134 | 134 | // we're adding a scalar value to an array here |
@@ -170,7 +170,7 @@ discard block |
||
170 | 170 | |
171 | 171 | return 1; |
172 | 172 | } else { |
173 | - error_log('XML-RPC: ' . __METHOD__ . ': already initialized as a [' . $this->kindOf() . ']'); |
|
173 | + error_log('XML-RPC: '.__METHOD__.': already initialized as a ['.$this->kindOf().']'); |
|
174 | 174 | return 0; |
175 | 175 | } |
176 | 176 | } |
@@ -201,7 +201,7 @@ discard block |
||
201 | 201 | |
202 | 202 | return 1; |
203 | 203 | } else { |
204 | - error_log('XML-RPC: ' . __METHOD__ . ': already initialized as a [' . $this->kindOf() . ']'); |
|
204 | + error_log('XML-RPC: '.__METHOD__.': already initialized as a ['.$this->kindOf().']'); |
|
205 | 205 | return 0; |
206 | 206 | } |
207 | 207 | } |
@@ -240,19 +240,19 @@ discard block |
||
240 | 240 | case 1: |
241 | 241 | switch ($typ) { |
242 | 242 | case static::$xmlrpcBase64: |
243 | - $rs .= "<${typ}>" . base64_encode($val) . "</${typ}>"; |
|
243 | + $rs .= "<${typ}>".base64_encode($val)."</${typ}>"; |
|
244 | 244 | break; |
245 | 245 | case static::$xmlrpcBoolean: |
246 | - $rs .= "<${typ}>" . ($val ? '1' : '0') . "</${typ}>"; |
|
246 | + $rs .= "<${typ}>".($val ? '1' : '0')."</${typ}>"; |
|
247 | 247 | break; |
248 | 248 | case static::$xmlrpcString: |
249 | 249 | // Do NOT use htmlentities, since it will produce named html entities, which are invalid xml |
250 | - $rs .= "<${typ}>" . Charset::instance()->encodeEntities($val, PhpXmlRpc::$xmlrpc_internalencoding, $charsetEncoding) . "</${typ}>"; |
|
250 | + $rs .= "<${typ}>".Charset::instance()->encodeEntities($val, PhpXmlRpc::$xmlrpc_internalencoding, $charsetEncoding)."</${typ}>"; |
|
251 | 251 | break; |
252 | 252 | case static::$xmlrpcInt: |
253 | 253 | case static::$xmlrpcI4: |
254 | 254 | case static::$xmlrpcI8: |
255 | - $rs .= "<${typ}>" . (int)$val . "</${typ}>"; |
|
255 | + $rs .= "<${typ}>".(int) $val."</${typ}>"; |
|
256 | 256 | break; |
257 | 257 | case static::$xmlrpcDouble: |
258 | 258 | // avoid using standard conversion of float to string because it is locale-dependent, |
@@ -260,15 +260,15 @@ discard block |
||
260 | 260 | // sprintf('%F') could be most likely ok but it fails eg. on 2e-14. |
261 | 261 | // The code below tries its best at keeping max precision while avoiding exp notation, |
262 | 262 | // but there is of course no limit in the number of decimal places to be used... |
263 | - $rs .= "<${typ}>" . preg_replace('/\\.?0+$/', '', number_format((double)$val, 128, '.', '')) . "</${typ}>"; |
|
263 | + $rs .= "<${typ}>".preg_replace('/\\.?0+$/', '', number_format((double) $val, 128, '.', ''))."</${typ}>"; |
|
264 | 264 | break; |
265 | 265 | case static::$xmlrpcDateTime: |
266 | 266 | if (is_string($val)) { |
267 | 267 | $rs .= "<${typ}>${val}</${typ}>"; |
268 | 268 | } elseif (is_a($val, 'DateTime')) { |
269 | - $rs .= "<${typ}>" . $val->format('Ymd\TH:i:s') . "</${typ}>"; |
|
269 | + $rs .= "<${typ}>".$val->format('Ymd\TH:i:s')."</${typ}>"; |
|
270 | 270 | } elseif (is_int($val)) { |
271 | - $rs .= "<${typ}>" . strftime("%Y%m%dT%H:%M:%S", $val) . "</${typ}>"; |
|
271 | + $rs .= "<${typ}>".strftime("%Y%m%dT%H:%M:%S", $val)."</${typ}>"; |
|
272 | 272 | } else { |
273 | 273 | // not really a good idea here: but what shall we output anyway? left for backward compat... |
274 | 274 | $rs .= "<${typ}>${val}</${typ}>"; |
@@ -290,14 +290,14 @@ discard block |
||
290 | 290 | case 3: |
291 | 291 | // struct |
292 | 292 | if ($this->_php_class) { |
293 | - $rs .= '<struct php_class="' . $this->_php_class . "\">\n"; |
|
293 | + $rs .= '<struct php_class="'.$this->_php_class."\">\n"; |
|
294 | 294 | } else { |
295 | 295 | $rs .= "<struct>\n"; |
296 | 296 | } |
297 | 297 | $charsetEncoder = Charset::instance(); |
298 | 298 | /** @var Value $val2 */ |
299 | 299 | foreach ($val as $key2 => $val2) { |
300 | - $rs .= '<member><name>' . $charsetEncoder->encodeEntities($key2, PhpXmlRpc::$xmlrpc_internalencoding, $charsetEncoding) . "</name>\n"; |
|
300 | + $rs .= '<member><name>'.$charsetEncoder->encodeEntities($key2, PhpXmlRpc::$xmlrpc_internalencoding, $charsetEncoding)."</name>\n"; |
|
301 | 301 | //$rs.=$this->serializeval($val2); |
302 | 302 | $rs .= $val2->serialize($charsetEncoding); |
303 | 303 | $rs .= "</member>\n"; |
@@ -333,7 +333,7 @@ discard block |
||
333 | 333 | $val = reset($this->me); |
334 | 334 | $typ = key($this->me); |
335 | 335 | |
336 | - return '<value>' . $this->serializedata($typ, $val, $charsetEncoding) . "</value>\n"; |
|
336 | + return '<value>'.$this->serializedata($typ, $val, $charsetEncoding)."</value>\n"; |
|
337 | 337 | } |
338 | 338 | |
339 | 339 | /** |
@@ -2,10 +2,10 @@ discard block |
||
2 | 2 | /** |
3 | 3 | * NB: do not let your IDE fool you. The correct encoding for this file is NOT UTF8. |
4 | 4 | */ |
5 | -include_once __DIR__ . '/../lib/xmlrpc.inc'; |
|
6 | -include_once __DIR__ . '/../lib/xmlrpcs.inc'; |
|
5 | +include_once __DIR__.'/../lib/xmlrpc.inc'; |
|
6 | +include_once __DIR__.'/../lib/xmlrpcs.inc'; |
|
7 | 7 | |
8 | -include_once __DIR__ . '/parse_args.php'; |
|
8 | +include_once __DIR__.'/parse_args.php'; |
|
9 | 9 | |
10 | 10 | /** |
11 | 11 | * Tests involving parsing of xml and handling of xmlrpc values |
@@ -61,7 +61,7 @@ discard block |
||
61 | 61 | |
62 | 62 | public function testUnicodeInMemberName() |
63 | 63 | { |
64 | - $str = "G" . chr(252) . "nter, El" . chr(232) . "ne"; |
|
64 | + $str = "G".chr(252)."nter, El".chr(232)."ne"; |
|
65 | 65 | $v = array($str => new xmlrpcval(1)); |
66 | 66 | $r = new xmlrpcresp(new xmlrpcval($v, 'struct')); |
67 | 67 | $r = $r->serialize(); |
@@ -77,7 +77,7 @@ discard block |
||
77 | 77 | '<?xml version="1.0"?> |
78 | 78 | <!-- $Id --> |
79 | 79 | <!-- found by G. Giunta, covers what happens when lib receives UTF8 chars in response text and comments --> |
80 | -<!-- ' . chr(224) . chr(252) . chr(232) . 'àüè --> |
|
80 | +<!-- ' . chr(224).chr(252).chr(232).'àüè --> |
|
81 | 81 | <methodResponse> |
82 | 82 | <fault> |
83 | 83 | <value> |
@@ -88,7 +88,7 @@ discard block |
||
88 | 88 | </member> |
89 | 89 | <member> |
90 | 90 | <name>faultString</name> |
91 | -<value><string>' . chr(224) . chr(252) . chr(232) . 'àüè</string></value> |
|
91 | +<value><string>' . chr(224).chr(252).chr(232).'àüè</string></value> |
|
92 | 92 | </member> |
93 | 93 | </struct> |
94 | 94 | </value> |
@@ -97,7 +97,7 @@ discard block |
||
97 | 97 | $m = $this->newMsg('dummy'); |
98 | 98 | $r = $m->parseResponse($response); |
99 | 99 | $v = $r->faultString(); |
100 | - $this->assertEquals(chr(224) . chr(252) . chr(232) . chr(224) . chr(252) . chr(232), $v); |
|
100 | + $this->assertEquals(chr(224).chr(252).chr(232).chr(224).chr(252).chr(232), $v); |
|
101 | 101 | } |
102 | 102 | |
103 | 103 | public function testValidNumbers() |
@@ -158,7 +158,7 @@ discard block |
||
158 | 158 | |
159 | 159 | public function testI8() |
160 | 160 | { |
161 | - if (PHP_INT_SIZE == 4 ) { |
|
161 | + if (PHP_INT_SIZE == 4) { |
|
162 | 162 | $this->markTestSkipped('did not find a locale which sets decimal separator to comma'); |
163 | 163 | return; |
164 | 164 | } |
@@ -481,11 +481,11 @@ discard block |
||
481 | 481 | |
482 | 482 | public function testUTF8Response() |
483 | 483 | { |
484 | - $string = chr(224) . chr(252) . chr(232); |
|
484 | + $string = chr(224).chr(252).chr(232); |
|
485 | 485 | |
486 | 486 | $s = $this->newMsg('dummy'); |
487 | - $f = "HTTP/1.1 200 OK\r\nContent-type: text/xml; charset=UTF-8\r\n\r\n" . '<?xml version="1.0"?><methodResponse><params><param><value><struct><member><name>userid</name><value>311127</value></member> |
|
488 | -<member><name>dateCreated</name><value><dateTime.iso8601>20011126T09:17:52</dateTime.iso8601></value></member><member><name>content</name><value>' . utf8_encode($string) . '</value></member><member><name>postid</name><value>7414222</value></member></struct></value></param></params></methodResponse> |
|
487 | + $f = "HTTP/1.1 200 OK\r\nContent-type: text/xml; charset=UTF-8\r\n\r\n".'<?xml version="1.0"?><methodResponse><params><param><value><struct><member><name>userid</name><value>311127</value></member> |
|
488 | +<member><name>dateCreated</name><value><dateTime.iso8601>20011126T09:17:52</dateTime.iso8601></value></member><member><name>content</name><value>' . utf8_encode($string).'</value></member><member><name>postid</name><value>7414222</value></member></struct></value></param></params></methodResponse> |
|
489 | 489 | '; |
490 | 490 | $r = $s->parseResponse($f, false, 'phpvals'); |
491 | 491 | $v = $r->value(); |
@@ -493,7 +493,7 @@ discard block |
||
493 | 493 | $this->assertEquals($string, $v); |
494 | 494 | |
495 | 495 | $f = '<?xml version="1.0" encoding="UTF-8"?><methodResponse><params><param><value><struct><member><name>userid</name><value>311127</value></member> |
496 | -<member><name>dateCreated</name><value><dateTime.iso8601>20011126T09:17:52</dateTime.iso8601></value></member><member><name>content</name><value>' . utf8_encode($string) . '</value></member><member><name>postid</name><value>7414222</value></member></struct></value></param></params></methodResponse> |
|
496 | +<member><name>dateCreated</name><value><dateTime.iso8601>20011126T09:17:52</dateTime.iso8601></value></member><member><name>content</name><value>' . utf8_encode($string).'</value></member><member><name>postid</name><value>7414222</value></member></struct></value></param></params></methodResponse> |
|
497 | 497 | '; |
498 | 498 | $r = $s->parseResponse($f, false, 'phpvals'); |
499 | 499 | $v = $r->value(); |
@@ -508,11 +508,11 @@ discard block |
||
508 | 508 | |
509 | 509 | public function testLatin1Response() |
510 | 510 | { |
511 | - $string = chr(224) . chr(252) . chr(232); |
|
511 | + $string = chr(224).chr(252).chr(232); |
|
512 | 512 | |
513 | 513 | $s = $this->newMsg('dummy'); |
514 | - $f = "HTTP/1.1 200 OK\r\nContent-type: text/xml; charset=ISO-8859-1\r\n\r\n" . '<?xml version="1.0"?><methodResponse><params><param><value><struct><member><name>userid</name><value>311127</value></member> |
|
515 | -<member><name>dateCreated</name><value><dateTime.iso8601>20011126T09:17:52</dateTime.iso8601></value></member><member><name>content</name><value>' . $string . '</value></member><member><name>postid</name><value>7414222</value></member></struct></value></param></params></methodResponse> |
|
514 | + $f = "HTTP/1.1 200 OK\r\nContent-type: text/xml; charset=ISO-8859-1\r\n\r\n".'<?xml version="1.0"?><methodResponse><params><param><value><struct><member><name>userid</name><value>311127</value></member> |
|
515 | +<member><name>dateCreated</name><value><dateTime.iso8601>20011126T09:17:52</dateTime.iso8601></value></member><member><name>content</name><value>' . $string.'</value></member><member><name>postid</name><value>7414222</value></member></struct></value></param></params></methodResponse> |
|
516 | 516 | '; |
517 | 517 | $r = $s->parseResponse($f, false, 'phpvals'); |
518 | 518 | $v = $r->value(); |
@@ -520,7 +520,7 @@ discard block |
||
520 | 520 | $this->assertEquals($string, $v); |
521 | 521 | |
522 | 522 | $f = '<?xml version="1.0" encoding="ISO-8859-1"?><methodResponse><params><param><value><struct><member><name>userid</name><value>311127</value></member> |
523 | -<member><name>dateCreated</name><value><dateTime.iso8601>20011126T09:17:52</dateTime.iso8601></value></member><member><name>content</name><value>' . $string . '</value></member><member><name>postid</name><value>7414222</value></member></struct></value></param></params></methodResponse> |
|
523 | +<member><name>dateCreated</name><value><dateTime.iso8601>20011126T09:17:52</dateTime.iso8601></value></member><member><name>content</name><value>' . $string.'</value></member><member><name>postid</name><value>7414222</value></member></struct></value></param></params></methodResponse> |
|
524 | 524 | '; |
525 | 525 | $r = $s->parseResponse($f, false, 'phpvals'); |
526 | 526 | $v = $r->value(); |
@@ -615,7 +615,7 @@ discard block |
||
615 | 615 | $this->assertequals(1, count($v1)); |
616 | 616 | $out = array('me' => array(), 'mytype' => 2, '_php_class' => null); |
617 | 617 | |
618 | - foreach($v1 as $key => $val) |
|
618 | + foreach ($v1 as $key => $val) |
|
619 | 619 | { |
620 | 620 | $this->assertArrayHasKey($key, $out); |
621 | 621 | $expected = $out[$key]; |
@@ -630,7 +630,7 @@ discard block |
||
630 | 630 | $this->assertequals(2, count($v2)); |
631 | 631 | $out = array(array('key' => 0, 'value' => 'object'), array('key' => 1, 'value' => 'object')); |
632 | 632 | $i = 0; |
633 | - foreach($v2 as $key => $val) |
|
633 | + foreach ($v2 as $key => $val) |
|
634 | 634 | { |
635 | 635 | $expected = $out[$i]; |
636 | 636 | $this->assertequals($expected['key'], $key); |
@@ -643,7 +643,7 @@ discard block |
||
643 | 643 | { |
644 | 644 | // nb: make sure that the serialized xml corresponding to this is > 10MB in size |
645 | 645 | $data = array(); |
646 | - for ($i = 0; $i < 500000; $i++ ) { |
|
646 | + for ($i = 0; $i<500000; $i++) { |
|
647 | 647 | $data[] = 'hello world'; |
648 | 648 | } |
649 | 649 |