@@ -38,9 +38,9 @@ discard block |
||
| 38 | 38 | public function xml_header($charsetEncoding = '') |
| 39 | 39 | { |
| 40 | 40 | if ($charsetEncoding != '') { |
| 41 | - return "<?xml version=\"1.0\" encoding=\"$charsetEncoding\" ?" . ">\n<methodCall>\n"; |
|
| 41 | + return "<?xml version=\"1.0\" encoding=\"$charsetEncoding\" ?".">\n<methodCall>\n"; |
|
| 42 | 42 | } else { |
| 43 | - return "<?xml version=\"1.0\"?" . ">\n<methodCall>\n"; |
|
| 43 | + return "<?xml version=\"1.0\"?".">\n<methodCall>\n"; |
|
| 44 | 44 | } |
| 45 | 45 | } |
| 46 | 46 | |
@@ -52,16 +52,16 @@ discard block |
||
| 52 | 52 | public function createPayload($charsetEncoding = '') |
| 53 | 53 | { |
| 54 | 54 | if ($charsetEncoding != '') { |
| 55 | - $this->content_type = 'text/xml; charset=' . $charsetEncoding; |
|
| 55 | + $this->content_type = 'text/xml; charset='.$charsetEncoding; |
|
| 56 | 56 | } else { |
| 57 | 57 | $this->content_type = 'text/xml'; |
| 58 | 58 | } |
| 59 | 59 | $this->payload = $this->xml_header($charsetEncoding); |
| 60 | - $this->payload .= '<methodName>' . Charset::instance()->encodeEntities( |
|
| 61 | - $this->methodname, PhpXmlRpc::$xmlrpc_internalencoding, $charsetEncoding) . "</methodName>\n"; |
|
| 60 | + $this->payload .= '<methodName>'.Charset::instance()->encodeEntities( |
|
| 61 | + $this->methodname, PhpXmlRpc::$xmlrpc_internalencoding, $charsetEncoding)."</methodName>\n"; |
|
| 62 | 62 | $this->payload .= "<params>\n"; |
| 63 | 63 | foreach ($this->params as $p) { |
| 64 | - $this->payload .= "<param>\n" . $p->serialize($charsetEncoding) . |
|
| 64 | + $this->payload .= "<param>\n".$p->serialize($charsetEncoding). |
|
| 65 | 65 | "</param>\n"; |
| 66 | 66 | } |
| 67 | 67 | $this->payload .= "</params>\n"; |
@@ -186,7 +186,7 @@ discard block |
||
| 186 | 186 | $this->httpResponse = array('raw_data' => $data, 'headers' => array(), 'cookies' => array()); |
| 187 | 187 | |
| 188 | 188 | if ($data == '') { |
| 189 | - Logger::instance()->errorLog('XML-RPC: ' . __METHOD__ . ': no response received from server.'); |
|
| 189 | + Logger::instance()->errorLog('XML-RPC: '.__METHOD__.': no response received from server.'); |
|
| 190 | 190 | return new Response(0, PhpXmlRpc::$xmlrpcerr['no_data'], PhpXmlRpc::$xmlrpcstr['no_data']); |
| 191 | 191 | } |
| 192 | 192 | |
@@ -195,7 +195,7 @@ discard block |
||
| 195 | 195 | $httpParser = new Http(); |
| 196 | 196 | try { |
| 197 | 197 | $this->httpResponse = $httpParser->parseResponseHeaders($data, $headersProcessed, $this->debug); |
| 198 | - } catch(\Exception $e) { |
|
| 198 | + } catch (\Exception $e) { |
|
| 199 | 199 | $r = new Response(0, $e->getCode(), $e->getMessage()); |
| 200 | 200 | // failed processing of HTTP response headers |
| 201 | 201 | // save into response obj the full payload received, for debugging |
@@ -214,7 +214,7 @@ discard block |
||
| 214 | 214 | // idea from Luca Mariano <[email protected]> originally in PEARified version of the lib |
| 215 | 215 | $pos = strrpos($data, '</methodResponse>'); |
| 216 | 216 | if ($pos !== false) { |
| 217 | - $data = substr($data, 0, $pos + 17); |
|
| 217 | + $data = substr($data, 0, $pos+17); |
|
| 218 | 218 | } |
| 219 | 219 | |
| 220 | 220 | // try to 'guestimate' the character encoding of the received response |
@@ -225,9 +225,9 @@ discard block |
||
| 225 | 225 | if ($start) { |
| 226 | 226 | $start += strlen('<!-- SERVER DEBUG INFO (BASE64 ENCODED):'); |
| 227 | 227 | $end = strpos($data, '-->', $start); |
| 228 | - $comments = substr($data, $start, $end - $start); |
|
| 229 | - Logger::instance()->debugMessage("---SERVER DEBUG INFO (DECODED) ---\n\t" . |
|
| 230 | - str_replace("\n", "\n\t", base64_decode($comments)) . "\n---END---", $respEncoding); |
|
| 228 | + $comments = substr($data, $start, $end-$start); |
|
| 229 | + Logger::instance()->debugMessage("---SERVER DEBUG INFO (DECODED) ---\n\t". |
|
| 230 | + str_replace("\n", "\n\t", base64_decode($comments))."\n---END---", $respEncoding); |
|
| 231 | 231 | } |
| 232 | 232 | } |
| 233 | 233 | |
@@ -254,7 +254,7 @@ discard block |
||
| 254 | 254 | if (extension_loaded('mbstring')) { |
| 255 | 255 | $data = mb_convert_encoding($data, 'UTF-8', $respEncoding); |
| 256 | 256 | } else { |
| 257 | - Logger::instance()->errorLog('XML-RPC: ' . __METHOD__ . ': invalid charset encoding of received response: ' . $respEncoding); |
|
| 257 | + Logger::instance()->errorLog('XML-RPC: '.__METHOD__.': invalid charset encoding of received response: '.$respEncoding); |
|
| 258 | 258 | } |
| 259 | 259 | } |
| 260 | 260 | } |
@@ -274,12 +274,12 @@ discard block |
||
| 274 | 274 | $xmlRpcParser->parse($data, $returnType, XMLParser::ACCEPT_RESPONSE); |
| 275 | 275 | |
| 276 | 276 | // first error check: xml not well formed |
| 277 | - if ($xmlRpcParser->_xh['isf'] > 2) { |
|
| 277 | + if ($xmlRpcParser->_xh['isf']>2) { |
|
| 278 | 278 | |
| 279 | 279 | // BC break: in the past for some cases we used the error message: 'XML error at line 1, check URL' |
| 280 | 280 | |
| 281 | 281 | $r = new Response(0, PhpXmlRpc::$xmlrpcerr['invalid_return'], |
| 282 | - PhpXmlRpc::$xmlrpcstr['invalid_return'] . ' ' . $xmlRpcParser->_xh['isf_reason']); |
|
| 282 | + PhpXmlRpc::$xmlrpcstr['invalid_return'].' '.$xmlRpcParser->_xh['isf_reason']); |
|
| 283 | 283 | |
| 284 | 284 | if ($this->debug) { |
| 285 | 285 | print $xmlRpcParser->_xh['isf_reason']; |
@@ -292,7 +292,7 @@ discard block |
||
| 292 | 292 | } |
| 293 | 293 | |
| 294 | 294 | $r = new Response(0, PhpXmlRpc::$xmlrpcerr['invalid_return'], |
| 295 | - PhpXmlRpc::$xmlrpcstr['invalid_return'] . ' ' . $xmlRpcParser->_xh['isf_reason']); |
|
| 295 | + PhpXmlRpc::$xmlrpcstr['invalid_return'].' '.$xmlRpcParser->_xh['isf_reason']); |
|
| 296 | 296 | } |
| 297 | 297 | // third error check: parsing of the response has somehow gone boink. |
| 298 | 298 | // NB: shall we omit this check, since we trust the parsing code? |
@@ -303,7 +303,7 @@ discard block |
||
| 303 | 303 | $r = new Response(0, PhpXmlRpc::$xmlrpcerr['invalid_return'], |
| 304 | 304 | PhpXmlRpc::$xmlrpcstr['invalid_return']); |
| 305 | 305 | } else { |
| 306 | - if ($this->debug > 1) { |
|
| 306 | + if ($this->debug>1) { |
|
| 307 | 307 | Logger::instance()->debugMessage( |
| 308 | 308 | "---PARSED---\n".var_export($xmlRpcParser->_xh['value'], true)."\n---END---" |
| 309 | 309 | ); |
@@ -151,7 +151,7 @@ discard block |
||
| 151 | 151 | */ |
| 152 | 152 | public static function xmlrpc_debugmsg($msg) |
| 153 | 153 | { |
| 154 | - static::$_xmlrpc_debuginfo .= $msg . "\n"; |
|
| 154 | + static::$_xmlrpc_debuginfo .= $msg."\n"; |
|
| 155 | 155 | } |
| 156 | 156 | |
| 157 | 157 | /** |
@@ -159,7 +159,7 @@ discard block |
||
| 159 | 159 | */ |
| 160 | 160 | public static function error_occurred($msg) |
| 161 | 161 | { |
| 162 | - static::$_xmlrpcs_occurred_errors .= $msg . "\n"; |
|
| 162 | + static::$_xmlrpcs_occurred_errors .= $msg."\n"; |
|
| 163 | 163 | } |
| 164 | 164 | |
| 165 | 165 | /** |
@@ -178,10 +178,10 @@ discard block |
||
| 178 | 178 | // user debug info should be encoded by the end user using the INTERNAL_ENCODING |
| 179 | 179 | $out = ''; |
| 180 | 180 | if ($this->debug_info != '') { |
| 181 | - $out .= "<!-- SERVER DEBUG INFO (BASE64 ENCODED):\n" . base64_encode($this->debug_info) . "\n-->\n"; |
|
| 181 | + $out .= "<!-- SERVER DEBUG INFO (BASE64 ENCODED):\n".base64_encode($this->debug_info)."\n-->\n"; |
|
| 182 | 182 | } |
| 183 | 183 | if (static::$_xmlrpc_debuginfo != '') { |
| 184 | - $out .= "<!-- DEBUG INFO:\n" . Charset::instance()->encodeEntities(str_replace('--', '_-', static::$_xmlrpc_debuginfo), PhpXmlRpc::$xmlrpc_internalencoding, $charsetEncoding) . "\n-->\n"; |
|
| 184 | + $out .= "<!-- DEBUG INFO:\n".Charset::instance()->encodeEntities(str_replace('--', '_-', static::$_xmlrpc_debuginfo), PhpXmlRpc::$xmlrpc_internalencoding, $charsetEncoding)."\n-->\n"; |
|
| 185 | 185 | // NB: a better solution MIGHT be to use CDATA, but we need to insert it |
| 186 | 186 | // into return payload AFTER the beginning tag |
| 187 | 187 | //$out .= "<![CDATA[ DEBUG INFO:\n\n" . str_replace(']]>', ']_]_>', static::$_xmlrpc_debuginfo) . "\n]]>\n"; |
@@ -211,8 +211,8 @@ discard block |
||
| 211 | 211 | $this->debug_info = ''; |
| 212 | 212 | |
| 213 | 213 | // Save what we received, before parsing it |
| 214 | - if ($this->debug > 1) { |
|
| 215 | - $this->debugmsg("+++GOT+++\n" . $data . "\n+++END+++"); |
|
| 214 | + if ($this->debug>1) { |
|
| 215 | + $this->debugmsg("+++GOT+++\n".$data."\n+++END+++"); |
|
| 216 | 216 | } |
| 217 | 217 | |
| 218 | 218 | $r = $this->parseRequestHeaders($data, $reqCharset, $respCharset, $respEncoding); |
@@ -224,21 +224,21 @@ discard block |
||
| 224 | 224 | // save full body of request into response, for more debugging usages |
| 225 | 225 | $r->raw_data = $rawData; |
| 226 | 226 | |
| 227 | - if ($this->debug > 2 && static::$_xmlrpcs_occurred_errors) { |
|
| 228 | - $this->debugmsg("+++PROCESSING ERRORS AND WARNINGS+++\n" . |
|
| 229 | - static::$_xmlrpcs_occurred_errors . "+++END+++"); |
|
| 227 | + if ($this->debug>2 && static::$_xmlrpcs_occurred_errors) { |
|
| 228 | + $this->debugmsg("+++PROCESSING ERRORS AND WARNINGS+++\n". |
|
| 229 | + static::$_xmlrpcs_occurred_errors."+++END+++"); |
|
| 230 | 230 | } |
| 231 | 231 | |
| 232 | 232 | $payload = $this->xml_header($respCharset); |
| 233 | - if ($this->debug > 0) { |
|
| 234 | - $payload = $payload . $this->serializeDebug($respCharset); |
|
| 233 | + if ($this->debug>0) { |
|
| 234 | + $payload = $payload.$this->serializeDebug($respCharset); |
|
| 235 | 235 | } |
| 236 | 236 | |
| 237 | 237 | // Do not create response serialization if it has already happened. Helps building json magic |
| 238 | 238 | if (empty($r->payload)) { |
| 239 | 239 | $r->serialize($respCharset); |
| 240 | 240 | } |
| 241 | - $payload = $payload . $r->payload; |
|
| 241 | + $payload = $payload.$r->payload; |
|
| 242 | 242 | |
| 243 | 243 | if ($returnPayload) { |
| 244 | 244 | return $payload; |
@@ -247,7 +247,7 @@ discard block |
||
| 247 | 247 | // if we get a warning/error that has output some text before here, then we cannot |
| 248 | 248 | // add a new header. We cannot say we are sending xml, either... |
| 249 | 249 | if (!headers_sent()) { |
| 250 | - header('Content-Type: ' . $r->content_type); |
|
| 250 | + header('Content-Type: '.$r->content_type); |
|
| 251 | 251 | // we do not know if client actually told us an accepted charset, but if he did |
| 252 | 252 | // we have to tell him what we did |
| 253 | 253 | header("Vary: Accept-Charset"); |
@@ -273,10 +273,10 @@ discard block |
||
| 273 | 273 | // do not output content-length header if php is compressing output for us: |
| 274 | 274 | // it will mess up measurements |
| 275 | 275 | if ($phpNoSelfCompress) { |
| 276 | - header('Content-Length: ' . (int)strlen($payload)); |
|
| 276 | + header('Content-Length: '.(int) strlen($payload)); |
|
| 277 | 277 | } |
| 278 | 278 | } else { |
| 279 | - Logger::instance()->errorLog('XML-RPC: ' . __METHOD__ . ': http headers already sent before response is fully generated. Check for php warning or error messages'); |
|
| 279 | + Logger::instance()->errorLog('XML-RPC: '.__METHOD__.': http headers already sent before response is fully generated. Check for php warning or error messages'); |
|
| 280 | 280 | } |
| 281 | 281 | |
| 282 | 282 | print $payload; |
@@ -325,9 +325,9 @@ discard block |
||
| 325 | 325 | $numParams = count($in); |
| 326 | 326 | } |
| 327 | 327 | foreach ($sigs as $curSig) { |
| 328 | - if (count($curSig) == $numParams + 1) { |
|
| 328 | + if (count($curSig) == $numParams+1) { |
|
| 329 | 329 | $itsOK = 1; |
| 330 | - for ($n = 0; $n < $numParams; $n++) { |
|
| 330 | + for ($n = 0; $n<$numParams; $n++) { |
|
| 331 | 331 | if (is_object($in)) { |
| 332 | 332 | $p = $in->getParam($n); |
| 333 | 333 | if ($p->kindOf() == 'scalar') { |
@@ -340,10 +340,10 @@ discard block |
||
| 340 | 340 | } |
| 341 | 341 | |
| 342 | 342 | // param index is $n+1, as first member of sig is return type |
| 343 | - if ($pt != $curSig[$n + 1] && $curSig[$n + 1] != Value::$xmlrpcValue) { |
|
| 343 | + if ($pt != $curSig[$n+1] && $curSig[$n+1] != Value::$xmlrpcValue) { |
|
| 344 | 344 | $itsOK = 0; |
| 345 | - $pno = $n + 1; |
|
| 346 | - $wanted = $curSig[$n + 1]; |
|
| 345 | + $pno = $n+1; |
|
| 346 | + $wanted = $curSig[$n+1]; |
|
| 347 | 347 | $got = $pt; |
| 348 | 348 | break; |
| 349 | 349 | } |
@@ -370,10 +370,10 @@ discard block |
||
| 370 | 370 | // check if $_SERVER is populated: it might have been disabled via ini file |
| 371 | 371 | // (this is true even when in CLI mode) |
| 372 | 372 | if (count($_SERVER) == 0) { |
| 373 | - Logger::instance()->errorLog('XML-RPC: ' . __METHOD__ . ': cannot parse request headers as $_SERVER is not populated'); |
|
| 373 | + Logger::instance()->errorLog('XML-RPC: '.__METHOD__.': cannot parse request headers as $_SERVER is not populated'); |
|
| 374 | 374 | } |
| 375 | 375 | |
| 376 | - if ($this->debug > 1) { |
|
| 376 | + if ($this->debug>1) { |
|
| 377 | 377 | if (function_exists('getallheaders')) { |
| 378 | 378 | $this->debugmsg(''); // empty line |
| 379 | 379 | foreach (getallheaders() as $name => $val) { |
@@ -395,13 +395,13 @@ discard block |
||
| 395 | 395 | if (function_exists('gzinflate') && in_array($contentEncoding, $this->accepted_compression)) { |
| 396 | 396 | if ($contentEncoding == 'deflate' && $degzdata = @gzuncompress($data)) { |
| 397 | 397 | $data = $degzdata; |
| 398 | - if ($this->debug > 1) { |
|
| 399 | - $this->debugmsg("\n+++INFLATED REQUEST+++[" . strlen($data) . " chars]+++\n" . $data . "\n+++END+++"); |
|
| 398 | + if ($this->debug>1) { |
|
| 399 | + $this->debugmsg("\n+++INFLATED REQUEST+++[".strlen($data)." chars]+++\n".$data."\n+++END+++"); |
|
| 400 | 400 | } |
| 401 | 401 | } elseif ($contentEncoding == 'gzip' && $degzdata = @gzinflate(substr($data, 10))) { |
| 402 | 402 | $data = $degzdata; |
| 403 | - if ($this->debug > 1) { |
|
| 404 | - $this->debugmsg("+++INFLATED REQUEST+++[" . strlen($data) . " chars]+++\n" . $data . "\n+++END+++"); |
|
| 403 | + if ($this->debug>1) { |
|
| 404 | + $this->debugmsg("+++INFLATED REQUEST+++[".strlen($data)." chars]+++\n".$data."\n+++END+++"); |
|
| 405 | 405 | } |
| 406 | 406 | } else { |
| 407 | 407 | $r = new Response(0, PhpXmlRpc::$xmlrpcerr['server_decompress_fail'], PhpXmlRpc::$xmlrpcstr['server_decompress_fail']); |
@@ -485,7 +485,7 @@ discard block |
||
| 485 | 485 | if (extension_loaded('mbstring')) { |
| 486 | 486 | $data = mb_convert_encoding($data, 'UTF-8', $reqEncoding); |
| 487 | 487 | } else { |
| 488 | - Logger::instance()->errorLog('XML-RPC: ' . __METHOD__ . ': invalid charset encoding of received request: ' . $reqEncoding); |
|
| 488 | + Logger::instance()->errorLog('XML-RPC: '.__METHOD__.': invalid charset encoding of received request: '.$reqEncoding); |
|
| 489 | 489 | } |
| 490 | 490 | } |
| 491 | 491 | } |
@@ -503,16 +503,16 @@ discard block |
||
| 503 | 503 | |
| 504 | 504 | $xmlRpcParser = new XMLParser($options); |
| 505 | 505 | $xmlRpcParser->parse($data, $this->functions_parameters_type, XMLParser::ACCEPT_REQUEST); |
| 506 | - if ($xmlRpcParser->_xh['isf'] > 2) { |
|
| 506 | + if ($xmlRpcParser->_xh['isf']>2) { |
|
| 507 | 507 | // (BC) we return XML error as a faultCode |
| 508 | 508 | preg_match('/^XML error ([0-9]+)/', $xmlRpcParser->_xh['isf_reason'], $matches); |
| 509 | 509 | $r = new Response(0, |
| 510 | - PhpXmlRpc::$xmlrpcerrxml + $matches[1], |
|
| 510 | + PhpXmlRpc::$xmlrpcerrxml+$matches[1], |
|
| 511 | 511 | $xmlRpcParser->_xh['isf_reason']); |
| 512 | 512 | } elseif ($xmlRpcParser->_xh['isf']) { |
| 513 | 513 | $r = new Response(0, |
| 514 | 514 | PhpXmlRpc::$xmlrpcerr['invalid_request'], |
| 515 | - PhpXmlRpc::$xmlrpcstr['invalid_request'] . ' ' . $xmlRpcParser->_xh['isf_reason']); |
|
| 515 | + PhpXmlRpc::$xmlrpcstr['invalid_request'].' '.$xmlRpcParser->_xh['isf_reason']); |
|
| 516 | 516 | } else { |
| 517 | 517 | // small layering violation in favor of speed and memory usage: |
| 518 | 518 | // we should allow the 'execute' method handle this, but in the |
@@ -523,20 +523,20 @@ discard block |
||
| 523 | 523 | ($this->dmap[$xmlRpcParser->_xh['method']]['parameters_type'] == 'phpvals') |
| 524 | 524 | ) |
| 525 | 525 | ) { |
| 526 | - if ($this->debug > 1) { |
|
| 527 | - $this->debugmsg("\n+++PARSED+++\n" . var_export($xmlRpcParser->_xh['params'], true) . "\n+++END+++"); |
|
| 526 | + if ($this->debug>1) { |
|
| 527 | + $this->debugmsg("\n+++PARSED+++\n".var_export($xmlRpcParser->_xh['params'], true)."\n+++END+++"); |
|
| 528 | 528 | } |
| 529 | 529 | $r = $this->execute($xmlRpcParser->_xh['method'], $xmlRpcParser->_xh['params'], $xmlRpcParser->_xh['pt']); |
| 530 | 530 | } else { |
| 531 | 531 | // build a Request object with data parsed from xml |
| 532 | 532 | $req = new Request($xmlRpcParser->_xh['method']); |
| 533 | 533 | // now add parameters in |
| 534 | - for ($i = 0; $i < count($xmlRpcParser->_xh['params']); $i++) { |
|
| 534 | + for ($i = 0; $i<count($xmlRpcParser->_xh['params']); $i++) { |
|
| 535 | 535 | $req->addParam($xmlRpcParser->_xh['params'][$i]); |
| 536 | 536 | } |
| 537 | 537 | |
| 538 | - if ($this->debug > 1) { |
|
| 539 | - $this->debugmsg("\n+++PARSED+++\n" . var_export($req, true) . "\n+++END+++"); |
|
| 538 | + if ($this->debug>1) { |
|
| 539 | + $this->debugmsg("\n+++PARSED+++\n".var_export($req, true)."\n+++END+++"); |
|
| 540 | 540 | } |
| 541 | 541 | $r = $this->execute($req); |
| 542 | 542 | } |
@@ -589,7 +589,7 @@ discard block |
||
| 589 | 589 | return new Response( |
| 590 | 590 | 0, |
| 591 | 591 | PhpXmlRpc::$xmlrpcerr['incorrect_params'], |
| 592 | - PhpXmlRpc::$xmlrpcstr['incorrect_params'] . ": ${errStr}" |
|
| 592 | + PhpXmlRpc::$xmlrpcstr['incorrect_params'].": ${errStr}" |
|
| 593 | 593 | ); |
| 594 | 594 | } |
| 595 | 595 | } |
@@ -602,7 +602,7 @@ discard block |
||
| 602 | 602 | |
| 603 | 603 | if (is_array($func)) { |
| 604 | 604 | if (is_object($func[0])) { |
| 605 | - $funcName = get_class($func[0]) . '->' . $func[1]; |
|
| 605 | + $funcName = get_class($func[0]).'->'.$func[1]; |
|
| 606 | 606 | } else { |
| 607 | 607 | $funcName = implode('::', $func); |
| 608 | 608 | } |
@@ -614,17 +614,17 @@ discard block |
||
| 614 | 614 | |
| 615 | 615 | // verify that function to be invoked is in fact callable |
| 616 | 616 | if (!is_callable($func)) { |
| 617 | - Logger::instance()->errorLog("XML-RPC: " . __METHOD__ . ": function '$funcName' registered as method handler is not callable"); |
|
| 617 | + Logger::instance()->errorLog("XML-RPC: ".__METHOD__.": function '$funcName' registered as method handler is not callable"); |
|
| 618 | 618 | return new Response( |
| 619 | 619 | 0, |
| 620 | 620 | PhpXmlRpc::$xmlrpcerr['server_error'], |
| 621 | - PhpXmlRpc::$xmlrpcstr['server_error'] . ": no function matches method" |
|
| 621 | + PhpXmlRpc::$xmlrpcstr['server_error'].": no function matches method" |
|
| 622 | 622 | ); |
| 623 | 623 | } |
| 624 | 624 | |
| 625 | 625 | // If debug level is 3, we should catch all errors generated during |
| 626 | 626 | // processing of user function, and log them as part of response |
| 627 | - if ($this->debug > 2) { |
|
| 627 | + if ($this->debug>2) { |
|
| 628 | 628 | self::$_xmlrpcs_prev_ehandler = set_error_handler(array('\PhpXmlRpc\Server', '_xmlrpcs_errorHandler')); |
| 629 | 629 | } |
| 630 | 630 | |
@@ -637,14 +637,14 @@ discard block |
||
| 637 | 637 | $r = call_user_func($func, $req); |
| 638 | 638 | } |
| 639 | 639 | if (!is_a($r, 'PhpXmlRpc\Response')) { |
| 640 | - Logger::instance()->errorLog("XML-RPC: " . __METHOD__ . ": function '$funcName' registered as method handler does not return an xmlrpc response object but a " . gettype($r)); |
|
| 640 | + Logger::instance()->errorLog("XML-RPC: ".__METHOD__.": function '$funcName' registered as method handler does not return an xmlrpc response object but a ".gettype($r)); |
|
| 641 | 641 | if (is_a($r, 'PhpXmlRpc\Value')) { |
| 642 | 642 | $r = new Response($r); |
| 643 | 643 | } else { |
| 644 | 644 | $r = new Response( |
| 645 | 645 | 0, |
| 646 | 646 | PhpXmlRpc::$xmlrpcerr['server_error'], |
| 647 | - PhpXmlRpc::$xmlrpcstr['server_error'] . ": function does not return xmlrpc response object" |
|
| 647 | + PhpXmlRpc::$xmlrpcstr['server_error'].": function does not return xmlrpc response object" |
|
| 648 | 648 | ); |
| 649 | 649 | } |
| 650 | 650 | } |
@@ -660,7 +660,7 @@ discard block |
||
| 660 | 660 | // mimic EPI behaviour: if we get an array that looks like an error, make it |
| 661 | 661 | // an eror response |
| 662 | 662 | if (is_array($r) && array_key_exists('faultCode', $r) && array_key_exists('faultString', $r)) { |
| 663 | - $r = new Response(0, (integer)$r['faultCode'], (string)$r['faultString']); |
|
| 663 | + $r = new Response(0, (integer) $r['faultCode'], (string) $r['faultString']); |
|
| 664 | 664 | } else { |
| 665 | 665 | // functions using EPI api should NOT return resp objects, |
| 666 | 666 | // so make sure we encode the return type correctly |
@@ -684,7 +684,7 @@ discard block |
||
| 684 | 684 | // in the called function, we wrap it in a proper error-response |
| 685 | 685 | switch ($this->exception_handling) { |
| 686 | 686 | case 2: |
| 687 | - if ($this->debug > 2) { |
|
| 687 | + if ($this->debug>2) { |
|
| 688 | 688 | if (self::$_xmlrpcs_prev_ehandler) { |
| 689 | 689 | set_error_handler(self::$_xmlrpcs_prev_ehandler); |
| 690 | 690 | } else { |
@@ -700,7 +700,7 @@ discard block |
||
| 700 | 700 | $r = new Response(0, PhpXmlRpc::$xmlrpcerr['server_error'], PhpXmlRpc::$xmlrpcstr['server_error']); |
| 701 | 701 | } |
| 702 | 702 | } |
| 703 | - if ($this->debug > 2) { |
|
| 703 | + if ($this->debug>2) { |
|
| 704 | 704 | // note: restore the error handler we found before calling the |
| 705 | 705 | // user func, even if it has been changed inside the func itself |
| 706 | 706 | if (self::$_xmlrpcs_prev_ehandler) { |
@@ -720,7 +720,7 @@ discard block |
||
| 720 | 720 | */ |
| 721 | 721 | protected function debugmsg($string) |
| 722 | 722 | { |
| 723 | - $this->debug_info .= $string . "\n"; |
|
| 723 | + $this->debug_info .= $string."\n"; |
|
| 724 | 724 | } |
| 725 | 725 | |
| 726 | 726 | /** |
@@ -730,9 +730,9 @@ discard block |
||
| 730 | 730 | protected function xml_header($charsetEncoding = '') |
| 731 | 731 | { |
| 732 | 732 | if ($charsetEncoding != '') { |
| 733 | - return "<?xml version=\"1.0\" encoding=\"$charsetEncoding\"?" . ">\n"; |
|
| 733 | + return "<?xml version=\"1.0\" encoding=\"$charsetEncoding\"?".">\n"; |
|
| 734 | 734 | } else { |
| 735 | - return "<?xml version=\"1.0\"?" . ">\n"; |
|
| 735 | + return "<?xml version=\"1.0\"?".">\n"; |
|
| 736 | 736 | } |
| 737 | 737 | } |
| 738 | 738 | |
@@ -965,12 +965,12 @@ discard block |
||
| 965 | 965 | } |
| 966 | 966 | |
| 967 | 967 | $req = new Request($methName->scalarval()); |
| 968 | - foreach($params as $i => $param) { |
|
| 968 | + foreach ($params as $i => $param) { |
|
| 969 | 969 | if (!$req->addParam($param)) { |
| 970 | 970 | $i++; // for error message, we count params from 1 |
| 971 | 971 | return static::_xmlrpcs_multicall_error(new Response(0, |
| 972 | 972 | PhpXmlRpc::$xmlrpcerr['incorrect_params'], |
| 973 | - PhpXmlRpc::$xmlrpcstr['incorrect_params'] . ": probable xml error in param " . $i)); |
|
| 973 | + PhpXmlRpc::$xmlrpcstr['incorrect_params'].": probable xml error in param ".$i)); |
|
| 974 | 974 | } |
| 975 | 975 | } |
| 976 | 976 | |
@@ -1037,12 +1037,12 @@ discard block |
||
| 1037 | 1037 | // let accept a plain list of php parameters, beside a single xmlrpc msg object |
| 1038 | 1038 | if (is_object($req)) { |
| 1039 | 1039 | $calls = $req->getParam(0); |
| 1040 | - foreach($calls as $call) { |
|
| 1040 | + foreach ($calls as $call) { |
|
| 1041 | 1041 | $result[] = static::_xmlrpcs_multicall_do_call($server, $call); |
| 1042 | 1042 | } |
| 1043 | 1043 | } else { |
| 1044 | 1044 | $numCalls = count($req); |
| 1045 | - for ($i = 0; $i < $numCalls; $i++) { |
|
| 1045 | + for ($i = 0; $i<$numCalls; $i++) { |
|
| 1046 | 1046 | $result[$i] = static::_xmlrpcs_multicall_do_call_phpvals($server, $req[$i]); |
| 1047 | 1047 | } |
| 1048 | 1048 | } |
@@ -135,10 +135,10 @@ discard block |
||
| 135 | 135 | $server = $parts['host']; |
| 136 | 136 | $path = isset($parts['path']) ? $parts['path'] : ''; |
| 137 | 137 | if (isset($parts['query'])) { |
| 138 | - $path .= '?' . $parts['query']; |
|
| 138 | + $path .= '?'.$parts['query']; |
|
| 139 | 139 | } |
| 140 | 140 | if (isset($parts['fragment'])) { |
| 141 | - $path .= '#' . $parts['fragment']; |
|
| 141 | + $path .= '#'.$parts['fragment']; |
|
| 142 | 142 | } |
| 143 | 143 | if (isset($parts['port'])) { |
| 144 | 144 | $port = $parts['port']; |
@@ -154,7 +154,7 @@ discard block |
||
| 154 | 154 | } |
| 155 | 155 | } |
| 156 | 156 | if ($path == '' || $path[0] != '/') { |
| 157 | - $this->path = '/' . $path; |
|
| 157 | + $this->path = '/'.$path; |
|
| 158 | 158 | } else { |
| 159 | 159 | $this->path = $path; |
| 160 | 160 | } |
@@ -192,7 +192,7 @@ discard block |
||
| 192 | 192 | }*/ |
| 193 | 193 | |
| 194 | 194 | // initialize user_agent string |
| 195 | - $this->user_agent = PhpXmlRpc::$xmlrpcName . ' ' . PhpXmlRpc::$xmlrpcVersion; |
|
| 195 | + $this->user_agent = PhpXmlRpc::$xmlrpcName.' '.PhpXmlRpc::$xmlrpcVersion; |
|
| 196 | 196 | } |
| 197 | 197 | |
| 198 | 198 | /** |
@@ -564,7 +564,7 @@ discard block |
||
| 564 | 564 | */ |
| 565 | 565 | protected function sendPayloadHTTP10($req, $server, $port, $timeout = 0, $username = '', $password = '', |
| 566 | 566 | $authType = 1, $proxyHost = '', $proxyPort = 0, $proxyUsername = '', $proxyPassword = '', $proxyAuthType = 1, |
| 567 | - $method='http') |
|
| 567 | + $method = 'http') |
|
| 568 | 568 | { |
| 569 | 569 | //trigger_error('Method ' . __METHOD__ . ' is deprecated', E_USER_DEPRECATED); |
| 570 | 570 | |
@@ -596,7 +596,7 @@ discard block |
||
| 596 | 596 | * @param int $sslVersion |
| 597 | 597 | * @return Response |
| 598 | 598 | */ |
| 599 | - protected function sendPayloadHTTPS($req, $server, $port, $timeout = 0, $username = '', $password = '', |
|
| 599 | + protected function sendPayloadHTTPS($req, $server, $port, $timeout = 0, $username = '', $password = '', |
|
| 600 | 600 | $authType = 1, $cert = '', $certPass = '', $caCert = '', $caCertDir = '', $proxyHost = '', $proxyPort = 0, |
| 601 | 601 | $proxyUsername = '', $proxyPassword = '', $proxyAuthType = 1, $keepAlive = false, $key = '', $keyPass = '', |
| 602 | 602 | $sslVersion = 0) |
@@ -633,11 +633,11 @@ discard block |
||
| 633 | 633 | */ |
| 634 | 634 | protected function sendPayloadSocket($req, $server, $port, $timeout = 0, $username = '', $password = '', |
| 635 | 635 | $authType = 1, $cert = '', $certPass = '', $caCert = '', $caCertDir = '', $proxyHost = '', $proxyPort = 0, |
| 636 | - $proxyUsername = '', $proxyPassword = '', $proxyAuthType = 1, $method='http', $key = '', $keyPass = '', |
|
| 636 | + $proxyUsername = '', $proxyPassword = '', $proxyAuthType = 1, $method = 'http', $key = '', $keyPass = '', |
|
| 637 | 637 | $sslVersion = 0) |
| 638 | 638 | { |
| 639 | 639 | if ($port == 0) { |
| 640 | - $port = ( $method === 'https' ) ? 443 : 80; |
|
| 640 | + $port = ($method === 'https') ? 443 : 80; |
|
| 641 | 641 | } |
| 642 | 642 | |
| 643 | 643 | // Only create the payload if it was not created previously |
@@ -667,15 +667,15 @@ discard block |
||
| 667 | 667 | // thanks to Grant Rauscher <[email protected]> for this |
| 668 | 668 | $credentials = ''; |
| 669 | 669 | if ($username != '') { |
| 670 | - $credentials = 'Authorization: Basic ' . base64_encode($username . ':' . $password) . "\r\n"; |
|
| 670 | + $credentials = 'Authorization: Basic '.base64_encode($username.':'.$password)."\r\n"; |
|
| 671 | 671 | if ($authType != 1) { |
| 672 | - Logger::instance()->errorLog('XML-RPC: ' . __METHOD__ . ': warning. Only Basic auth is supported with HTTP 1.0'); |
|
| 672 | + Logger::instance()->errorLog('XML-RPC: '.__METHOD__.': warning. Only Basic auth is supported with HTTP 1.0'); |
|
| 673 | 673 | } |
| 674 | 674 | } |
| 675 | 675 | |
| 676 | 676 | $acceptedEncoding = ''; |
| 677 | 677 | if (is_array($this->accepted_compression) && count($this->accepted_compression)) { |
| 678 | - $acceptedEncoding = 'Accept-Encoding: ' . implode(', ', $this->accepted_compression) . "\r\n"; |
|
| 678 | + $acceptedEncoding = 'Accept-Encoding: '.implode(', ', $this->accepted_compression)."\r\n"; |
|
| 679 | 679 | } |
| 680 | 680 | |
| 681 | 681 | $proxyCredentials = ''; |
@@ -686,17 +686,17 @@ discard block |
||
| 686 | 686 | $connectServer = $proxyHost; |
| 687 | 687 | $connectPort = $proxyPort; |
| 688 | 688 | $transport = 'tcp'; |
| 689 | - $uri = 'http://' . $server . ':' . $port . $this->path; |
|
| 689 | + $uri = 'http://'.$server.':'.$port.$this->path; |
|
| 690 | 690 | if ($proxyUsername != '') { |
| 691 | 691 | if ($proxyAuthType != 1) { |
| 692 | - Logger::instance()->errorLog('XML-RPC: ' . __METHOD__ . ': warning. Only Basic auth to proxy is supported with HTTP 1.0'); |
|
| 692 | + Logger::instance()->errorLog('XML-RPC: '.__METHOD__.': warning. Only Basic auth to proxy is supported with HTTP 1.0'); |
|
| 693 | 693 | } |
| 694 | - $proxyCredentials = 'Proxy-Authorization: Basic ' . base64_encode($proxyUsername . ':' . $proxyPassword) . "\r\n"; |
|
| 694 | + $proxyCredentials = 'Proxy-Authorization: Basic '.base64_encode($proxyUsername.':'.$proxyPassword)."\r\n"; |
|
| 695 | 695 | } |
| 696 | 696 | } else { |
| 697 | 697 | $connectServer = $server; |
| 698 | 698 | $connectPort = $port; |
| 699 | - $transport = ( $method === 'https' ) ? 'tls' : 'tcp'; |
|
| 699 | + $transport = ($method === 'https') ? 'tls' : 'tcp'; |
|
| 700 | 700 | $uri = $this->path; |
| 701 | 701 | } |
| 702 | 702 | |
@@ -706,45 +706,45 @@ discard block |
||
| 706 | 706 | $version = ''; |
| 707 | 707 | foreach ($this->cookies as $name => $cookie) { |
| 708 | 708 | if ($cookie['version']) { |
| 709 | - $version = ' $Version="' . $cookie['version'] . '";'; |
|
| 710 | - $cookieHeader .= ' ' . $name . '="' . $cookie['value'] . '";'; |
|
| 709 | + $version = ' $Version="'.$cookie['version'].'";'; |
|
| 710 | + $cookieHeader .= ' '.$name.'="'.$cookie['value'].'";'; |
|
| 711 | 711 | if ($cookie['path']) { |
| 712 | - $cookieHeader .= ' $Path="' . $cookie['path'] . '";'; |
|
| 712 | + $cookieHeader .= ' $Path="'.$cookie['path'].'";'; |
|
| 713 | 713 | } |
| 714 | 714 | if ($cookie['domain']) { |
| 715 | - $cookieHeader .= ' $Domain="' . $cookie['domain'] . '";'; |
|
| 715 | + $cookieHeader .= ' $Domain="'.$cookie['domain'].'";'; |
|
| 716 | 716 | } |
| 717 | 717 | if ($cookie['port']) { |
| 718 | - $cookieHeader .= ' $Port="' . $cookie['port'] . '";'; |
|
| 718 | + $cookieHeader .= ' $Port="'.$cookie['port'].'";'; |
|
| 719 | 719 | } |
| 720 | 720 | } else { |
| 721 | - $cookieHeader .= ' ' . $name . '=' . $cookie['value'] . ";"; |
|
| 721 | + $cookieHeader .= ' '.$name.'='.$cookie['value'].";"; |
|
| 722 | 722 | } |
| 723 | 723 | } |
| 724 | - $cookieHeader = 'Cookie:' . $version . substr($cookieHeader, 0, -1) . "\r\n"; |
|
| 724 | + $cookieHeader = 'Cookie:'.$version.substr($cookieHeader, 0, -1)."\r\n"; |
|
| 725 | 725 | } |
| 726 | 726 | |
| 727 | 727 | // omit port if default |
| 728 | 728 | if (($port == 80 && in_array($method, array('http', 'http10'))) || ($port == 443 && $method == 'https')) { |
| 729 | - $port = ''; |
|
| 729 | + $port = ''; |
|
| 730 | 730 | } else { |
| 731 | - $port = ':' . $port; |
|
| 731 | + $port = ':'.$port; |
|
| 732 | 732 | } |
| 733 | 733 | |
| 734 | - $op = 'POST ' . $uri . " HTTP/1.0\r\n" . |
|
| 735 | - 'User-Agent: ' . $this->user_agent . "\r\n" . |
|
| 736 | - 'Host: ' . $server . $port . "\r\n" . |
|
| 737 | - $credentials . |
|
| 738 | - $proxyCredentials . |
|
| 739 | - $acceptedEncoding . |
|
| 740 | - $encodingHdr . |
|
| 741 | - 'Accept-Charset: ' . implode(',', $this->accepted_charset_encodings) . "\r\n" . |
|
| 742 | - $cookieHeader . |
|
| 743 | - 'Content-Type: ' . $req->content_type . "\r\nContent-Length: " . |
|
| 744 | - strlen($payload) . "\r\n\r\n" . |
|
| 734 | + $op = 'POST '.$uri." HTTP/1.0\r\n". |
|
| 735 | + 'User-Agent: '.$this->user_agent."\r\n". |
|
| 736 | + 'Host: '.$server.$port."\r\n". |
|
| 737 | + $credentials. |
|
| 738 | + $proxyCredentials. |
|
| 739 | + $acceptedEncoding. |
|
| 740 | + $encodingHdr. |
|
| 741 | + 'Accept-Charset: '.implode(',', $this->accepted_charset_encodings)."\r\n". |
|
| 742 | + $cookieHeader. |
|
| 743 | + 'Content-Type: '.$req->content_type."\r\nContent-Length: ". |
|
| 744 | + strlen($payload)."\r\n\r\n". |
|
| 745 | 745 | $payload; |
| 746 | 746 | |
| 747 | - if ($this->debug > 1) { |
|
| 747 | + if ($this->debug>1) { |
|
| 748 | 748 | Logger::instance()->debugMessage("---SENDING---\n$op\n---END---"); |
| 749 | 749 | } |
| 750 | 750 | |
@@ -770,7 +770,7 @@ discard block |
||
| 770 | 770 | } |
| 771 | 771 | $context = stream_context_create($contextOptions); |
| 772 | 772 | |
| 773 | - if ($timeout <= 0) { |
|
| 773 | + if ($timeout<=0) { |
|
| 774 | 774 | $connectTimeout = ini_get('default_socket_timeout'); |
| 775 | 775 | } else { |
| 776 | 776 | $connectTimeout = $timeout; |
@@ -782,7 +782,7 @@ discard block |
||
| 782 | 782 | $fp = @stream_socket_client("$transport://$connectServer:$connectPort", $this->errno, $this->errstr, $connectTimeout, |
| 783 | 783 | STREAM_CLIENT_CONNECT, $context); |
| 784 | 784 | if ($fp) { |
| 785 | - if ($timeout > 0) { |
|
| 785 | + if ($timeout>0) { |
|
| 786 | 786 | stream_set_timeout($fp, $timeout); |
| 787 | 787 | } |
| 788 | 788 | } else { |
@@ -790,8 +790,8 @@ discard block |
||
| 790 | 790 | $err = error_get_last(); |
| 791 | 791 | $this->errstr = $err['message']; |
| 792 | 792 | } |
| 793 | - $this->errstr = 'Connect error: ' . $this->errstr; |
|
| 794 | - $r = new Response(0, PhpXmlRpc::$xmlrpcerr['http_error'], $this->errstr . ' (' . $this->errno . ')'); |
|
| 793 | + $this->errstr = 'Connect error: '.$this->errstr; |
|
| 794 | + $r = new Response(0, PhpXmlRpc::$xmlrpcerr['http_error'], $this->errstr.' ('.$this->errno.')'); |
|
| 795 | 795 | |
| 796 | 796 | return $r; |
| 797 | 797 | } |
@@ -898,7 +898,7 @@ discard block |
||
| 898 | 898 | $encodingHdr = ''; |
| 899 | 899 | } |
| 900 | 900 | |
| 901 | - if ($this->debug > 1) { |
|
| 901 | + if ($this->debug>1) { |
|
| 902 | 902 | Logger::instance()->debugMessage("---SENDING---\n$payload\n---END---"); |
| 903 | 903 | } |
| 904 | 904 | |
@@ -908,7 +908,7 @@ discard block |
||
| 908 | 908 | } else { |
| 909 | 909 | $protocol = $method; |
| 910 | 910 | } |
| 911 | - $curl = curl_init($protocol . '://' . $server . ':' . $port . $this->path); |
|
| 911 | + $curl = curl_init($protocol.'://'.$server.':'.$port.$this->path); |
|
| 912 | 912 | if ($keepAlive) { |
| 913 | 913 | $this->xmlrpc_curl_handle = $curl; |
| 914 | 914 | } |
@@ -919,7 +919,7 @@ discard block |
||
| 919 | 919 | // results into variable |
| 920 | 920 | curl_setopt($curl, CURLOPT_RETURNTRANSFER, true); |
| 921 | 921 | |
| 922 | - if ($this->debug > 1) { |
|
| 922 | + if ($this->debug>1) { |
|
| 923 | 923 | curl_setopt($curl, CURLOPT_VERBOSE, true); |
| 924 | 924 | /// @todo allow callers to redirect curlopt_stderr to some stream which can be buffered |
| 925 | 925 | } |
@@ -944,7 +944,7 @@ discard block |
||
| 944 | 944 | } |
| 945 | 945 | } |
| 946 | 946 | // extra headers |
| 947 | - $headers = array('Content-Type: ' . $req->content_type, 'Accept-Charset: ' . implode(',', $this->accepted_charset_encodings)); |
|
| 947 | + $headers = array('Content-Type: '.$req->content_type, 'Accept-Charset: '.implode(',', $this->accepted_charset_encodings)); |
|
| 948 | 948 | // if no keepalive is wanted, let the server know it in advance |
| 949 | 949 | if (!$keepAlive) { |
| 950 | 950 | $headers[] = 'Connection: close'; |
@@ -961,7 +961,7 @@ discard block |
||
| 961 | 961 | curl_setopt($curl, CURLOPT_HTTPHEADER, $headers); |
| 962 | 962 | // timeout is borked |
| 963 | 963 | if ($timeout) { |
| 964 | - curl_setopt($curl, CURLOPT_TIMEOUT, $timeout == 1 ? 1 : $timeout - 1); |
|
| 964 | + curl_setopt($curl, CURLOPT_TIMEOUT, $timeout == 1 ? 1 : $timeout-1); |
|
| 965 | 965 | } |
| 966 | 966 | |
| 967 | 967 | if ($method == 'http10') { |
@@ -971,11 +971,11 @@ discard block |
||
| 971 | 971 | } |
| 972 | 972 | |
| 973 | 973 | if ($username && $password) { |
| 974 | - curl_setopt($curl, CURLOPT_USERPWD, $username . ':' . $password); |
|
| 974 | + curl_setopt($curl, CURLOPT_USERPWD, $username.':'.$password); |
|
| 975 | 975 | if (defined('CURLOPT_HTTPAUTH')) { |
| 976 | 976 | curl_setopt($curl, CURLOPT_HTTPAUTH, $authType); |
| 977 | 977 | } elseif ($authType != 1) { |
| 978 | - Logger::instance()->errorLog('XML-RPC: ' . __METHOD__ . ': warning. Only Basic auth is supported by the current PHP/curl install'); |
|
| 978 | + Logger::instance()->errorLog('XML-RPC: '.__METHOD__.': warning. Only Basic auth is supported by the current PHP/curl install'); |
|
| 979 | 979 | } |
| 980 | 980 | } |
| 981 | 981 | |
@@ -1017,13 +1017,13 @@ discard block |
||
| 1017 | 1017 | if ($proxyPort == 0) { |
| 1018 | 1018 | $proxyPort = 8080; // NB: even for HTTPS, local connection is on port 8080 |
| 1019 | 1019 | } |
| 1020 | - curl_setopt($curl, CURLOPT_PROXY, $proxyHost . ':' . $proxyPort); |
|
| 1020 | + curl_setopt($curl, CURLOPT_PROXY, $proxyHost.':'.$proxyPort); |
|
| 1021 | 1021 | if ($proxyUsername) { |
| 1022 | - curl_setopt($curl, CURLOPT_PROXYUSERPWD, $proxyUsername . ':' . $proxyPassword); |
|
| 1022 | + curl_setopt($curl, CURLOPT_PROXYUSERPWD, $proxyUsername.':'.$proxyPassword); |
|
| 1023 | 1023 | if (defined('CURLOPT_PROXYAUTH')) { |
| 1024 | 1024 | curl_setopt($curl, CURLOPT_PROXYAUTH, $proxyAuthType); |
| 1025 | 1025 | } elseif ($proxyAuthType != 1) { |
| 1026 | - Logger::instance()->errorLog('XML-RPC: ' . __METHOD__ . ': warning. Only Basic auth to proxy is supported by the current PHP/curl install'); |
|
| 1026 | + Logger::instance()->errorLog('XML-RPC: '.__METHOD__.': warning. Only Basic auth to proxy is supported by the current PHP/curl install'); |
|
| 1027 | 1027 | } |
| 1028 | 1028 | } |
| 1029 | 1029 | } |
@@ -1033,7 +1033,7 @@ discard block |
||
| 1033 | 1033 | if (count($this->cookies)) { |
| 1034 | 1034 | $cookieHeader = ''; |
| 1035 | 1035 | foreach ($this->cookies as $name => $cookie) { |
| 1036 | - $cookieHeader .= $name . '=' . $cookie['value'] . '; '; |
|
| 1036 | + $cookieHeader .= $name.'='.$cookie['value'].'; '; |
|
| 1037 | 1037 | } |
| 1038 | 1038 | curl_setopt($curl, CURLOPT_COOKIE, substr($cookieHeader, 0, -2)); |
| 1039 | 1039 | } |
@@ -1044,13 +1044,13 @@ discard block |
||
| 1044 | 1044 | |
| 1045 | 1045 | $result = curl_exec($curl); |
| 1046 | 1046 | |
| 1047 | - if ($this->debug > 1) { |
|
| 1047 | + if ($this->debug>1) { |
|
| 1048 | 1048 | $message = "---CURL INFO---\n"; |
| 1049 | 1049 | foreach (curl_getinfo($curl) as $name => $val) { |
| 1050 | 1050 | if (is_array($val)) { |
| 1051 | 1051 | $val = implode("\n", $val); |
| 1052 | 1052 | } |
| 1053 | - $message .= $name . ': ' . $val . "\n"; |
|
| 1053 | + $message .= $name.': '.$val."\n"; |
|
| 1054 | 1054 | } |
| 1055 | 1055 | $message .= '---END---'; |
| 1056 | 1056 | Logger::instance()->debugMessage($message); |
@@ -1060,7 +1060,7 @@ discard block |
||
| 1060 | 1060 | /// @todo we should use a better check here - what if we get back '' or '0'? |
| 1061 | 1061 | |
| 1062 | 1062 | $this->errstr = 'no response'; |
| 1063 | - $resp = new Response(0, PhpXmlRpc::$xmlrpcerr['curl_fail'], PhpXmlRpc::$xmlrpcstr['curl_fail'] . ': ' . curl_error($curl)); |
|
| 1063 | + $resp = new Response(0, PhpXmlRpc::$xmlrpcerr['curl_fail'], PhpXmlRpc::$xmlrpcstr['curl_fail'].': '.curl_error($curl)); |
|
| 1064 | 1064 | curl_close($curl); |
| 1065 | 1065 | if ($keepAlive) { |
| 1066 | 1066 | $this->xmlrpc_curl_handle = null; |
@@ -1170,7 +1170,7 @@ discard block |
||
| 1170 | 1170 | $call['methodName'] = new Value($req->method(), 'string'); |
| 1171 | 1171 | $numParams = $req->getNumParams(); |
| 1172 | 1172 | $params = array(); |
| 1173 | - for ($i = 0; $i < $numParams; $i++) { |
|
| 1173 | + for ($i = 0; $i<$numParams; $i++) { |
|
| 1174 | 1174 | $params[$i] = $req->getParam($i); |
| 1175 | 1175 | } |
| 1176 | 1176 | $call['params'] = new Value($params, 'array'); |
@@ -1196,15 +1196,15 @@ discard block |
||
| 1196 | 1196 | /// @todo test this code branch... |
| 1197 | 1197 | $rets = $result->value(); |
| 1198 | 1198 | if (!is_array($rets)) { |
| 1199 | - return false; // bad return type from system.multicall |
|
| 1199 | + return false; // bad return type from system.multicall |
|
| 1200 | 1200 | } |
| 1201 | 1201 | $numRets = count($rets); |
| 1202 | 1202 | if ($numRets != count($reqs)) { |
| 1203 | - return false; // wrong number of return values. |
|
| 1203 | + return false; // wrong number of return values. |
|
| 1204 | 1204 | } |
| 1205 | 1205 | |
| 1206 | 1206 | $response = array(); |
| 1207 | - for ($i = 0; $i < $numRets; $i++) { |
|
| 1207 | + for ($i = 0; $i<$numRets; $i++) { |
|
| 1208 | 1208 | $val = $rets[$i]; |
| 1209 | 1209 | if (!is_array($val)) { |
| 1210 | 1210 | return false; |
@@ -1212,7 +1212,7 @@ discard block |
||
| 1212 | 1212 | switch (count($val)) { |
| 1213 | 1213 | case 1: |
| 1214 | 1214 | if (!isset($val[0])) { |
| 1215 | - return false; // Bad value |
|
| 1215 | + return false; // Bad value |
|
| 1216 | 1216 | } |
| 1217 | 1217 | // Normal return value |
| 1218 | 1218 | $response[$i] = new Response($val[0], 0, '', 'phpvals'); |
@@ -1240,19 +1240,19 @@ discard block |
||
| 1240 | 1240 | |
| 1241 | 1241 | $rets = $result->value(); |
| 1242 | 1242 | if ($rets->kindOf() != 'array') { |
| 1243 | - return false; // bad return type from system.multicall |
|
| 1243 | + return false; // bad return type from system.multicall |
|
| 1244 | 1244 | } |
| 1245 | 1245 | $numRets = $rets->count(); |
| 1246 | 1246 | if ($numRets != count($reqs)) { |
| 1247 | - return false; // wrong number of return values. |
|
| 1247 | + return false; // wrong number of return values. |
|
| 1248 | 1248 | } |
| 1249 | 1249 | |
| 1250 | 1250 | $response = array(); |
| 1251 | - foreach($rets as $val) { |
|
| 1251 | + foreach ($rets as $val) { |
|
| 1252 | 1252 | switch ($val->kindOf()) { |
| 1253 | 1253 | case 'array': |
| 1254 | 1254 | if ($val->count() != 1) { |
| 1255 | - return false; // Bad value |
|
| 1255 | + return false; // Bad value |
|
| 1256 | 1256 | } |
| 1257 | 1257 | // Normal return value |
| 1258 | 1258 | $response[] = new Response($val[0]); |
@@ -83,7 +83,7 @@ discard block |
||
| 83 | 83 | $this->me['struct'] = $val; |
| 84 | 84 | break; |
| 85 | 85 | default: |
| 86 | - Logger::instance()->errorLog("XML-RPC: " . __METHOD__ . ": not a known type ($type)"); |
|
| 86 | + Logger::instance()->errorLog("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 | - Logger::instance()->errorLog("XML-RPC: " . __METHOD__ . ": not a scalar type ($type)"); |
|
| 111 | + Logger::instance()->errorLog("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 | - Logger::instance()->errorLog('XML-RPC: ' . __METHOD__ . ': scalar xmlrpc value can have only one value'); |
|
| 128 | + Logger::instance()->errorLog('XML-RPC: '.__METHOD__.': scalar xmlrpc value can have only one value'); |
|
| 129 | 129 | return 0; |
| 130 | 130 | case 3: |
| 131 | - Logger::instance()->errorLog('XML-RPC: ' . __METHOD__ . ': cannot add anonymous scalar to struct xmlrpc value'); |
|
| 131 | + Logger::instance()->errorLog('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 | - Logger::instance()->errorLog('XML-RPC: ' . __METHOD__ . ': already initialized as a [' . $this->kindOf() . ']'); |
|
| 173 | + Logger::instance()->errorLog('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 | - Logger::instance()->errorLog('XML-RPC: ' . __METHOD__ . ': already initialized as a [' . $this->kindOf() . ']'); |
|
| 204 | + Logger::instance()->errorLog('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 | /** |
@@ -74,7 +74,7 @@ discard block |
||
| 74 | 74 | return $xmlrpcVal->scalarval(); |
| 75 | 75 | case 'array': |
| 76 | 76 | $arr = array(); |
| 77 | - foreach($xmlrpcVal as $value) { |
|
| 77 | + foreach ($xmlrpcVal as $value) { |
|
| 78 | 78 | $arr[] = $this->decode($value, $options); |
| 79 | 79 | } |
| 80 | 80 | |
@@ -104,7 +104,7 @@ discard block |
||
| 104 | 104 | case 'msg': |
| 105 | 105 | $paramCount = $xmlrpcVal->getNumParams(); |
| 106 | 106 | $arr = array(); |
| 107 | - for ($i = 0; $i < $paramCount; $i++) { |
|
| 107 | + for ($i = 0; $i<$paramCount; $i++) { |
|
| 108 | 108 | $arr[] = $this->decode($xmlrpcVal->getParam($i), $options); |
| 109 | 109 | } |
| 110 | 110 | |
@@ -179,7 +179,7 @@ discard block |
||
| 179 | 179 | $xmlrpcVal = new Value($phpVal->format('Ymd\TH:i:s'), Value::$xmlrpcStruct); |
| 180 | 180 | } else { |
| 181 | 181 | $arr = array(); |
| 182 | - foreach($phpVal as $k => $v) { |
|
| 182 | + foreach ($phpVal as $k => $v) { |
|
| 183 | 183 | $arr[$k] = $this->encode($v, $options); |
| 184 | 184 | } |
| 185 | 185 | $xmlrpcVal = new Value($arr, Value::$xmlrpcStruct); |
@@ -201,7 +201,7 @@ discard block |
||
| 201 | 201 | break; |
| 202 | 202 | case 'resource': |
| 203 | 203 | if (in_array('extension_api', $options)) { |
| 204 | - $xmlrpcVal = new Value((int)$phpVal, Value::$xmlrpcInt); |
|
| 204 | + $xmlrpcVal = new Value((int) $phpVal, Value::$xmlrpcInt); |
|
| 205 | 205 | } else { |
| 206 | 206 | $xmlrpcVal = new Value(); |
| 207 | 207 | } |
@@ -246,7 +246,7 @@ discard block |
||
| 246 | 246 | if (extension_loaded('mbstring')) { |
| 247 | 247 | $xmlVal = mb_convert_encoding($xmlVal, 'UTF-8', $valEncoding); |
| 248 | 248 | } else { |
| 249 | - Logger::instance()->errorLog('XML-RPC: ' . __METHOD__ . ': invalid charset encoding of xml text: ' . $valEncoding); |
|
| 249 | + Logger::instance()->errorLog('XML-RPC: '.__METHOD__.': invalid charset encoding of xml text: '.$valEncoding); |
|
| 250 | 250 | } |
| 251 | 251 | } |
| 252 | 252 | } |
@@ -262,7 +262,7 @@ discard block |
||
| 262 | 262 | $xmlRpcParser = new XMLParser($options); |
| 263 | 263 | $xmlRpcParser->parse($xmlVal, XMLParser::RETURN_XMLRPCVALS, XMLParser::ACCEPT_REQUEST | XMLParser::ACCEPT_RESPONSE | XMLParser::ACCEPT_VALUE); |
| 264 | 264 | |
| 265 | - if ($xmlRpcParser->_xh['isf'] > 1) { |
|
| 265 | + if ($xmlRpcParser->_xh['isf']>1) { |
|
| 266 | 266 | // test that $xmlrpc->_xh['value'] is an obj, too??? |
| 267 | 267 | |
| 268 | 268 | Logger::instance()->errorLog($xmlRpcParser->_xh['isf_reason']); |
@@ -286,7 +286,7 @@ discard block |
||
| 286 | 286 | return $r; |
| 287 | 287 | case 'methodcall': |
| 288 | 288 | $req = new Request($xmlRpcParser->_xh['method']); |
| 289 | - for ($i = 0; $i < count($xmlRpcParser->_xh['params']); $i++) { |
|
| 289 | + for ($i = 0; $i<count($xmlRpcParser->_xh['params']); $i++) { |
|
| 290 | 290 | $req->addParam($xmlRpcParser->_xh['params'][$i]); |
| 291 | 291 | } |
| 292 | 292 | |