@@ -57,13 +57,13 @@ discard block |
||
| 57 | 57 | 'scalar' => $val, |
| 58 | 58 | 'timestamp' => \PhpXmlRpc\Helper\Date::iso8601Decode($val) |
| 59 | 59 | ); |
| 60 | - return (object)$xmlrpcVal; |
|
| 60 | + return (object) $xmlrpcVal; |
|
| 61 | 61 | case 'base64': |
| 62 | 62 | $xmlrpcVal = array( |
| 63 | 63 | 'xmlrpc_type' => 'base64', |
| 64 | 64 | 'scalar' => $val |
| 65 | 65 | ); |
| 66 | - return (object)$xmlrpcVal; |
|
| 66 | + return (object) $xmlrpcVal; |
|
| 67 | 67 | case 'string': |
| 68 | 68 | if (isset($options['extension_api_encoding'])) { |
| 69 | 69 | // if iconv is not available, we use mb_convert_encoding |
@@ -136,7 +136,7 @@ discard block |
||
| 136 | 136 | case 'msg': |
| 137 | 137 | $paramCount = $xmlrpcVal->getNumParams(); |
| 138 | 138 | $arr = array(); |
| 139 | - for ($i = 0; $i < $paramCount; $i++) { |
|
| 139 | + for ($i = 0; $i<$paramCount; $i++) { |
|
| 140 | 140 | $arr[] = $this->decode($xmlrpcVal->getParam($i), $options); |
| 141 | 141 | } |
| 142 | 142 | return $arr; |
@@ -261,7 +261,7 @@ discard block |
||
| 261 | 261 | break; |
| 262 | 262 | case 'resource': |
| 263 | 263 | if (in_array('extension_api', $options)) { |
| 264 | - $xmlrpcVal = new Value((int)$phpVal, Value::$xmlrpcInt); |
|
| 264 | + $xmlrpcVal = new Value((int) $phpVal, Value::$xmlrpcInt); |
|
| 265 | 265 | } else { |
| 266 | 266 | $xmlrpcVal = new Value(); |
| 267 | 267 | } |
@@ -307,7 +307,7 @@ discard block |
||
| 307 | 307 | if (function_exists('mb_convert_encoding')) { |
| 308 | 308 | $xmlVal = mb_convert_encoding($xmlVal, 'UTF-8', $valEncoding); |
| 309 | 309 | } else { |
| 310 | - $this->getLogger()->error('XML-RPC: ' . __METHOD__ . ': invalid charset encoding of xml text: ' . $valEncoding); |
|
| 310 | + $this->getLogger()->error('XML-RPC: '.__METHOD__.': invalid charset encoding of xml text: '.$valEncoding); |
|
| 311 | 311 | } |
| 312 | 312 | } |
| 313 | 313 | } |
@@ -328,7 +328,7 @@ discard block |
||
| 328 | 328 | $parserOptions |
| 329 | 329 | ); |
| 330 | 330 | |
| 331 | - if ($xmlRpcParser->_xh['isf'] > 1) { |
|
| 331 | + if ($xmlRpcParser->_xh['isf']>1) { |
|
| 332 | 332 | // test that $xmlrpc->_xh['value'] is an obj, too??? |
| 333 | 333 | |
| 334 | 334 | $this->getLogger()->error($xmlRpcParser->_xh['isf_reason']); |
@@ -352,7 +352,7 @@ discard block |
||
| 352 | 352 | |
| 353 | 353 | case 'methodcall': |
| 354 | 354 | $req = new Request($xmlRpcParser->_xh['method']); |
| 355 | - for ($i = 0; $i < count($xmlRpcParser->_xh['params']); $i++) { |
|
| 355 | + for ($i = 0; $i<count($xmlRpcParser->_xh['params']); $i++) { |
|
| 356 | 356 | $req->addParam($xmlRpcParser->_xh['params'][$i]); |
| 357 | 357 | } |
| 358 | 358 | return $req; |
@@ -57,9 +57,9 @@ discard block |
||
| 57 | 57 | public function xml_header($charsetEncoding = '') |
| 58 | 58 | { |
| 59 | 59 | if ($charsetEncoding != '') { |
| 60 | - return "<?xml version=\"1.0\" encoding=\"$charsetEncoding\" ?" . ">\n<methodCall>\n"; |
|
| 60 | + return "<?xml version=\"1.0\" encoding=\"$charsetEncoding\" ?".">\n<methodCall>\n"; |
|
| 61 | 61 | } else { |
| 62 | - return "<?xml version=\"1.0\"?" . ">\n<methodCall>\n"; |
|
| 62 | + return "<?xml version=\"1.0\"?".">\n<methodCall>\n"; |
|
| 63 | 63 | } |
| 64 | 64 | } |
| 65 | 65 | |
@@ -82,16 +82,16 @@ discard block |
||
| 82 | 82 | public function createPayload($charsetEncoding = '') |
| 83 | 83 | { |
| 84 | 84 | if ($charsetEncoding != '') { |
| 85 | - $this->content_type = 'text/xml; charset=' . $charsetEncoding; |
|
| 85 | + $this->content_type = 'text/xml; charset='.$charsetEncoding; |
|
| 86 | 86 | } else { |
| 87 | 87 | $this->content_type = 'text/xml'; |
| 88 | 88 | } |
| 89 | 89 | $this->payload = $this->xml_header($charsetEncoding); |
| 90 | - $this->payload .= '<methodName>' . $this->getCharsetEncoder()->encodeEntities( |
|
| 91 | - $this->methodname, PhpXmlRpc::$xmlrpc_internalencoding, $charsetEncoding) . "</methodName>\n"; |
|
| 90 | + $this->payload .= '<methodName>'.$this->getCharsetEncoder()->encodeEntities( |
|
| 91 | + $this->methodname, PhpXmlRpc::$xmlrpc_internalencoding, $charsetEncoding)."</methodName>\n"; |
|
| 92 | 92 | $this->payload .= "<params>\n"; |
| 93 | 93 | foreach ($this->params as $p) { |
| 94 | - $this->payload .= "<param>\n" . $p->serialize($charsetEncoding) . |
|
| 94 | + $this->payload .= "<param>\n".$p->serialize($charsetEncoding). |
|
| 95 | 95 | "</param>\n"; |
| 96 | 96 | } |
| 97 | 97 | $this->payload .= "</params>\n"; |
@@ -141,7 +141,7 @@ discard block |
||
| 141 | 141 | |
| 142 | 142 | return true; |
| 143 | 143 | } else { |
| 144 | - $this->getLogger()->error('XML-RPC: ' . __METHOD__ . ': value passed in must be a PhpXmlRpc\Value'); |
|
| 144 | + $this->getLogger()->error('XML-RPC: '.__METHOD__.': value passed in must be a PhpXmlRpc\Value'); |
|
| 145 | 145 | return false; |
| 146 | 146 | } |
| 147 | 147 | } |
@@ -213,14 +213,14 @@ discard block |
||
| 213 | 213 | */ |
| 214 | 214 | public function parseResponse($data = '', $headersProcessed = false, $returnType = XMLParser::RETURN_XMLRPCVALS) |
| 215 | 215 | { |
| 216 | - if ($this->debug > 0) { |
|
| 216 | + if ($this->debug>0) { |
|
| 217 | 217 | $this->getLogger()->debug("---GOT---\n$data\n---END---"); |
| 218 | 218 | } |
| 219 | 219 | |
| 220 | 220 | $this->httpResponse = array('raw_data' => $data, 'headers' => array(), 'cookies' => array()); |
| 221 | 221 | |
| 222 | 222 | if ($data == '') { |
| 223 | - $this->getLogger()->error('XML-RPC: ' . __METHOD__ . ': no response received from server.'); |
|
| 223 | + $this->getLogger()->error('XML-RPC: '.__METHOD__.': no response received from server.'); |
|
| 224 | 224 | return new Response(0, PhpXmlRpc::$xmlrpcerr['no_data'], PhpXmlRpc::$xmlrpcstr['no_data']); |
| 225 | 225 | } |
| 226 | 226 | |
@@ -228,12 +228,12 @@ discard block |
||
| 228 | 228 | if (substr($data, 0, 4) == 'HTTP') { |
| 229 | 229 | $httpParser = new Http(); |
| 230 | 230 | try { |
| 231 | - $httpResponse = $httpParser->parseResponseHeaders($data, $headersProcessed, $this->debug > 0); |
|
| 231 | + $httpResponse = $httpParser->parseResponseHeaders($data, $headersProcessed, $this->debug>0); |
|
| 232 | 232 | } catch (HttpException $e) { |
| 233 | 233 | // failed processing of HTTP response headers |
| 234 | 234 | // save into response obj the full payload received, for debugging |
| 235 | 235 | return new Response(0, $e->getCode(), $e->getMessage(), '', array('raw_data' => $data, 'status_code', $e->statusCode())); |
| 236 | - } catch(\Exception $e) { |
|
| 236 | + } catch (\Exception $e) { |
|
| 237 | 237 | return new Response(0, $e->getCode(), $e->getMessage(), '', array('raw_data' => $data)); |
| 238 | 238 | } |
| 239 | 239 | } else { |
@@ -249,7 +249,7 @@ discard block |
||
| 249 | 249 | // idea from Luca Mariano <[email protected]> originally in PEARified version of the lib |
| 250 | 250 | $pos = strrpos($data, '</methodResponse>'); |
| 251 | 251 | if ($pos !== false) { |
| 252 | - $data = substr($data, 0, $pos + 17); |
|
| 252 | + $data = substr($data, 0, $pos+17); |
|
| 253 | 253 | } |
| 254 | 254 | |
| 255 | 255 | // try to 'guestimate' the character encoding of the received response |
@@ -258,21 +258,21 @@ discard block |
||
| 258 | 258 | $data |
| 259 | 259 | ); |
| 260 | 260 | |
| 261 | - if ($this->debug >= 0) { |
|
| 261 | + if ($this->debug>=0) { |
|
| 262 | 262 | $this->httpResponse = $httpResponse; |
| 263 | 263 | } else { |
| 264 | 264 | $httpResponse = null; |
| 265 | 265 | } |
| 266 | 266 | |
| 267 | - if ($this->debug > 0) { |
|
| 267 | + if ($this->debug>0) { |
|
| 268 | 268 | $start = strpos($data, '<!-- SERVER DEBUG INFO (BASE64 ENCODED):'); |
| 269 | 269 | if ($start) { |
| 270 | 270 | $start += strlen('<!-- SERVER DEBUG INFO (BASE64 ENCODED):'); |
| 271 | 271 | /// @todo what if there is no end tag? |
| 272 | 272 | $end = strpos($data, '-->', $start); |
| 273 | - $comments = substr($data, $start, $end - $start); |
|
| 274 | - $this->getLogger()->debug("---SERVER DEBUG INFO (DECODED) ---\n\t" . |
|
| 275 | - str_replace("\n", "\n\t", base64_decode($comments)) . "\n---END---", array('encoding' => $respEncoding)); |
|
| 273 | + $comments = substr($data, $start, $end-$start); |
|
| 274 | + $this->getLogger()->debug("---SERVER DEBUG INFO (DECODED) ---\n\t". |
|
| 275 | + str_replace("\n", "\n\t", base64_decode($comments))."\n---END---", array('encoding' => $respEncoding)); |
|
| 276 | 276 | } |
| 277 | 277 | } |
| 278 | 278 | |
@@ -291,7 +291,7 @@ discard block |
||
| 291 | 291 | if (function_exists('mb_convert_encoding')) { |
| 292 | 292 | $data = mb_convert_encoding($data, 'UTF-8', $respEncoding); |
| 293 | 293 | } else { |
| 294 | - $this->getLogger()->error('XML-RPC: ' . __METHOD__ . ': unsupported charset encoding of received response: ' . $respEncoding); |
|
| 294 | + $this->getLogger()->error('XML-RPC: '.__METHOD__.': unsupported charset encoding of received response: '.$respEncoding); |
|
| 295 | 295 | } |
| 296 | 296 | } |
| 297 | 297 | } |
@@ -316,16 +316,16 @@ discard block |
||
| 316 | 316 | // there could be proxies meddling with the request, or network data corruption... |
| 317 | 317 | |
| 318 | 318 | $r = new Response(0, PhpXmlRpc::$xmlrpcerr['invalid_xml'], |
| 319 | - PhpXmlRpc::$xmlrpcstr['invalid_xml'] . ' ' . $xmlRpcParser->_xh['isf_reason'], '', $httpResponse); |
|
| 319 | + PhpXmlRpc::$xmlrpcstr['invalid_xml'].' '.$xmlRpcParser->_xh['isf_reason'], '', $httpResponse); |
|
| 320 | 320 | |
| 321 | - if ($this->debug > 0) { |
|
| 321 | + if ($this->debug>0) { |
|
| 322 | 322 | $this->getLogger()->debug($xmlRpcParser->_xh['isf_reason']); |
| 323 | 323 | } |
| 324 | 324 | } |
| 325 | 325 | // second error check: xml well-formed but not xml-rpc compliant |
| 326 | 326 | elseif ($xmlRpcParser->_xh['isf'] == 2) { |
| 327 | 327 | $r = new Response(0, PhpXmlRpc::$xmlrpcerr['xml_not_compliant'], |
| 328 | - PhpXmlRpc::$xmlrpcstr['xml_not_compliant'] . ' ' . $xmlRpcParser->_xh['isf_reason'], '', $httpResponse); |
|
| 328 | + PhpXmlRpc::$xmlrpcstr['xml_not_compliant'].' '.$xmlRpcParser->_xh['isf_reason'], '', $httpResponse); |
|
| 329 | 329 | |
| 330 | 330 | /// @todo echo something for the user? check if it was already done by the parser... |
| 331 | 331 | //if ($this->debug > 0) { |
@@ -334,7 +334,7 @@ discard block |
||
| 334 | 334 | } |
| 335 | 335 | // third error check: parsing of the response has somehow gone boink. |
| 336 | 336 | /// @todo shall we omit this check, since we trust the parsing code? |
| 337 | - elseif ($xmlRpcParser->_xh['isf'] > 3 || $returnType == XMLParser::RETURN_XMLRPCVALS && !is_object($xmlRpcParser->_xh['value'])) { |
|
| 337 | + elseif ($xmlRpcParser->_xh['isf']>3 || $returnType == XMLParser::RETURN_XMLRPCVALS && !is_object($xmlRpcParser->_xh['value'])) { |
|
| 338 | 338 | // something odd has happened and it's time to generate a client side error indicating something odd went on |
| 339 | 339 | $r = new Response(0, PhpXmlRpc::$xmlrpcerr['xml_parsing_error'], PhpXmlRpc::$xmlrpcstr['xml_parsing_error'], |
| 340 | 340 | '', $httpResponse |
@@ -342,7 +342,7 @@ discard block |
||
| 342 | 342 | |
| 343 | 343 | /// @todo echo something for the user? |
| 344 | 344 | } else { |
| 345 | - if ($this->debug > 1) { |
|
| 345 | + if ($this->debug>1) { |
|
| 346 | 346 | $this->getLogger()->debug( |
| 347 | 347 | "---PARSED---\n".var_export($xmlRpcParser->_xh['value'], true)."\n---END---" |
| 348 | 348 | ); |
@@ -366,7 +366,7 @@ discard block |
||
| 366 | 366 | if ($errNo == 0) { |
| 367 | 367 | // FAULT returned, errno needs to reflect that |
| 368 | 368 | /// @todo feature creep - add this code to PhpXmlRpc::$xmlrpcerr |
| 369 | - $this->getLogger()->error('XML-RPC: ' . __METHOD__ . ': fault response received with faultCode 0 or null. Converted it to -1'); |
|
| 369 | + $this->getLogger()->error('XML-RPC: '.__METHOD__.': fault response received with faultCode 0 or null. Converted it to -1'); |
|
| 370 | 370 | $errNo = -1; |
| 371 | 371 | } |
| 372 | 372 | |
@@ -194,7 +194,7 @@ discard block |
||
| 194 | 194 | */ |
| 195 | 195 | public static function xmlrpc_debugmsg($msg) |
| 196 | 196 | { |
| 197 | - static::$_xmlrpc_debuginfo .= $msg . "\n"; |
|
| 197 | + static::$_xmlrpc_debuginfo .= $msg."\n"; |
|
| 198 | 198 | } |
| 199 | 199 | |
| 200 | 200 | /** |
@@ -206,7 +206,7 @@ discard block |
||
| 206 | 206 | */ |
| 207 | 207 | public static function error_occurred($msg) |
| 208 | 208 | { |
| 209 | - static::$_xmlrpcs_occurred_errors .= $msg . "\n"; |
|
| 209 | + static::$_xmlrpcs_occurred_errors .= $msg."\n"; |
|
| 210 | 210 | } |
| 211 | 211 | |
| 212 | 212 | /** |
@@ -227,10 +227,10 @@ discard block |
||
| 227 | 227 | // user debug info should be encoded by the end user using the INTERNAL_ENCODING |
| 228 | 228 | $out = ''; |
| 229 | 229 | if ($this->debug_info != '') { |
| 230 | - $out .= "<!-- SERVER DEBUG INFO (BASE64 ENCODED):\n" . base64_encode($this->debug_info) . "\n-->\n"; |
|
| 230 | + $out .= "<!-- SERVER DEBUG INFO (BASE64 ENCODED):\n".base64_encode($this->debug_info)."\n-->\n"; |
|
| 231 | 231 | } |
| 232 | 232 | if (static::$_xmlrpc_debuginfo != '') { |
| 233 | - $out .= "<!-- DEBUG INFO:\n" . $this->getCharsetEncoder()->encodeEntities(str_replace('--', '_-', static::$_xmlrpc_debuginfo), PhpXmlRpc::$xmlrpc_internalencoding, $charsetEncoding) . "\n-->\n"; |
|
| 233 | + $out .= "<!-- DEBUG INFO:\n".$this->getCharsetEncoder()->encodeEntities(str_replace('--', '_-', static::$_xmlrpc_debuginfo), PhpXmlRpc::$xmlrpc_internalencoding, $charsetEncoding)."\n-->\n"; |
|
| 234 | 234 | // NB: a better solution MIGHT be to use CDATA, but we need to insert it |
| 235 | 235 | // into return payload AFTER the beginning tag |
| 236 | 236 | //$out .= "<![CDATA[ DEBUG INFO:\n\n" . str_replace(']]>', ']_]_>', static::$_xmlrpc_debuginfo) . "\n]]>\n"; |
@@ -259,8 +259,8 @@ discard block |
||
| 259 | 259 | $this->debug_info = ''; |
| 260 | 260 | |
| 261 | 261 | // Save what we received, before parsing it |
| 262 | - if ($this->debug > 1) { |
|
| 263 | - $this->debugmsg("+++GOT+++\n" . $data . "\n+++END+++"); |
|
| 262 | + if ($this->debug>1) { |
|
| 263 | + $this->debugmsg("+++GOT+++\n".$data."\n+++END+++"); |
|
| 264 | 264 | } |
| 265 | 265 | |
| 266 | 266 | $resp = $this->parseRequestHeaders($data, $reqCharset, $respCharset, $respEncoding); |
@@ -277,14 +277,14 @@ discard block |
||
| 277 | 277 | $resp->raw_data = $rawData; |
| 278 | 278 | } |
| 279 | 279 | |
| 280 | - if ($this->debug > 2 && static::$_xmlrpcs_occurred_errors != '') { |
|
| 281 | - $this->debugmsg("+++PROCESSING ERRORS AND WARNINGS+++\n" . |
|
| 282 | - static::$_xmlrpcs_occurred_errors . "+++END+++"); |
|
| 280 | + if ($this->debug>2 && static::$_xmlrpcs_occurred_errors != '') { |
|
| 281 | + $this->debugmsg("+++PROCESSING ERRORS AND WARNINGS+++\n". |
|
| 282 | + static::$_xmlrpcs_occurred_errors."+++END+++"); |
|
| 283 | 283 | } |
| 284 | 284 | |
| 285 | 285 | $payload = $this->xml_header($respCharset); |
| 286 | - if ($this->debug > 0) { |
|
| 287 | - $payload = $payload . $this->serializeDebug($respCharset); |
|
| 286 | + if ($this->debug>0) { |
|
| 287 | + $payload = $payload.$this->serializeDebug($respCharset); |
|
| 288 | 288 | } |
| 289 | 289 | |
| 290 | 290 | // Do not create response serialization if it has already happened. Helps to build json magic |
@@ -292,7 +292,7 @@ discard block |
||
| 292 | 292 | if (empty($resp->payload)) { |
| 293 | 293 | $resp->serialize($respCharset); |
| 294 | 294 | } |
| 295 | - $payload = $payload . $resp->payload; |
|
| 295 | + $payload = $payload.$resp->payload; |
|
| 296 | 296 | |
| 297 | 297 | if ($returnPayload) { |
| 298 | 298 | return $payload; |
@@ -301,7 +301,7 @@ discard block |
||
| 301 | 301 | // if we get a warning/error that has output some text before here, then we cannot |
| 302 | 302 | // add a new header. We cannot say we are sending xml, either... |
| 303 | 303 | if (!headers_sent()) { |
| 304 | - header('Content-Type: ' . $resp->content_type); |
|
| 304 | + header('Content-Type: '.$resp->content_type); |
|
| 305 | 305 | // we do not know if client actually told us an accepted charset, but if it did we have to tell it what we did |
| 306 | 306 | header("Vary: Accept-Charset"); |
| 307 | 307 | |
@@ -324,10 +324,10 @@ discard block |
||
| 324 | 324 | // Note that Apache/mod_php will add (and even alter!) the Content-Length header on its own, but only for |
| 325 | 325 | // responses up to 8000 bytes |
| 326 | 326 | if ($phpNoSelfCompress) { |
| 327 | - header('Content-Length: ' . (int)strlen($payload)); |
|
| 327 | + header('Content-Length: '.(int) strlen($payload)); |
|
| 328 | 328 | } |
| 329 | 329 | } else { |
| 330 | - $this->getLogger()->error('XML-RPC: ' . __METHOD__ . ': http headers already sent before response is fully generated. Check for php warning or error messages'); |
|
| 330 | + $this->getLogger()->error('XML-RPC: '.__METHOD__.': http headers already sent before response is fully generated. Check for php warning or error messages'); |
|
| 331 | 331 | } |
| 332 | 332 | |
| 333 | 333 | print $payload; |
@@ -390,9 +390,9 @@ discard block |
||
| 390 | 390 | $numParams = count($in); |
| 391 | 391 | } |
| 392 | 392 | foreach ($sigs as $curSig) { |
| 393 | - if (count($curSig) == $numParams + 1) { |
|
| 393 | + if (count($curSig) == $numParams+1) { |
|
| 394 | 394 | $itsOK = 1; |
| 395 | - for ($n = 0; $n < $numParams; $n++) { |
|
| 395 | + for ($n = 0; $n<$numParams; $n++) { |
|
| 396 | 396 | if (is_object($in)) { |
| 397 | 397 | $p = $in->getParam($n); |
| 398 | 398 | if ($p->kindOf() == 'scalar') { |
@@ -405,10 +405,10 @@ discard block |
||
| 405 | 405 | } |
| 406 | 406 | |
| 407 | 407 | // param index is $n+1, as first member of sig is return type |
| 408 | - if ($pt != $curSig[$n + 1] && $curSig[$n + 1] != Value::$xmlrpcValue) { |
|
| 408 | + if ($pt != $curSig[$n+1] && $curSig[$n+1] != Value::$xmlrpcValue) { |
|
| 409 | 409 | $itsOK = 0; |
| 410 | - $pno = $n + 1; |
|
| 411 | - $wanted = $curSig[$n + 1]; |
|
| 410 | + $pno = $n+1; |
|
| 411 | + $wanted = $curSig[$n+1]; |
|
| 412 | 412 | $got = $pt; |
| 413 | 413 | break; |
| 414 | 414 | } |
@@ -435,10 +435,10 @@ discard block |
||
| 435 | 435 | // check if $_SERVER is populated: it might have been disabled via ini file |
| 436 | 436 | // (this is true even when in CLI mode) |
| 437 | 437 | if (count($_SERVER) == 0) { |
| 438 | - $this->getLogger()->error('XML-RPC: ' . __METHOD__ . ': cannot parse request headers as $_SERVER is not populated'); |
|
| 438 | + $this->getLogger()->error('XML-RPC: '.__METHOD__.': cannot parse request headers as $_SERVER is not populated'); |
|
| 439 | 439 | } |
| 440 | 440 | |
| 441 | - if ($this->debug > 1) { |
|
| 441 | + if ($this->debug>1) { |
|
| 442 | 442 | if (function_exists('getallheaders')) { |
| 443 | 443 | $this->debugmsg(''); // empty line |
| 444 | 444 | foreach (getallheaders() as $name => $val) { |
@@ -463,13 +463,13 @@ discard block |
||
| 463 | 463 | if (function_exists('gzinflate') && in_array($contentEncoding, $this->accepted_compression)) { |
| 464 | 464 | if ($contentEncoding == 'deflate' && $degzdata = @gzuncompress($data)) { |
| 465 | 465 | $data = $degzdata; |
| 466 | - if ($this->debug > 1) { |
|
| 467 | - $this->debugmsg("\n+++INFLATED REQUEST+++[" . strlen($data) . " chars]+++\n" . $data . "\n+++END+++"); |
|
| 466 | + if ($this->debug>1) { |
|
| 467 | + $this->debugmsg("\n+++INFLATED REQUEST+++[".strlen($data)." chars]+++\n".$data."\n+++END+++"); |
|
| 468 | 468 | } |
| 469 | 469 | } elseif ($contentEncoding == 'gzip' && $degzdata = @gzinflate(substr($data, 10))) { |
| 470 | 470 | $data = $degzdata; |
| 471 | - if ($this->debug > 1) { |
|
| 472 | - $this->debugmsg("+++INFLATED REQUEST+++[" . strlen($data) . " chars]+++\n" . $data . "\n+++END+++"); |
|
| 471 | + if ($this->debug>1) { |
|
| 472 | + $this->debugmsg("+++INFLATED REQUEST+++[".strlen($data)." chars]+++\n".$data."\n+++END+++"); |
|
| 473 | 473 | } |
| 474 | 474 | } else { |
| 475 | 475 | $r = new Response(0, PhpXmlRpc::$xmlrpcerr['server_decompress_fail'], |
@@ -553,7 +553,7 @@ discard block |
||
| 553 | 553 | if (function_exists('mb_convert_encoding')) { |
| 554 | 554 | $data = mb_convert_encoding($data, 'UTF-8', $reqEncoding); |
| 555 | 555 | } else { |
| 556 | - $this->getLogger()->error('XML-RPC: ' . __METHOD__ . ': unsupported charset encoding of received request: ' . $reqEncoding); |
|
| 556 | + $this->getLogger()->error('XML-RPC: '.__METHOD__.': unsupported charset encoding of received request: '.$reqEncoding); |
|
| 557 | 557 | } |
| 558 | 558 | } |
| 559 | 559 | } |
@@ -579,7 +579,7 @@ discard block |
||
| 579 | 579 | preg_match('/^XML error ([0-9]+)/', $xmlRpcParser->_xh['isf_reason'], $matches); |
| 580 | 580 | return new Response( |
| 581 | 581 | 0, |
| 582 | - PhpXmlRpc::$xmlrpcerrxml + (int)$matches[1], |
|
| 582 | + PhpXmlRpc::$xmlrpcerrxml+(int) $matches[1], |
|
| 583 | 583 | $xmlRpcParser->_xh['isf_reason']); |
| 584 | 584 | } elseif ($xmlRpcParser->_xh['isf']) { |
| 585 | 585 | /// @todo separate better the various cases, as we have done in Request::parseResponse: invalid xml-rpc vs. |
@@ -587,7 +587,7 @@ discard block |
||
| 587 | 587 | return new Response( |
| 588 | 588 | 0, |
| 589 | 589 | PhpXmlRpc::$xmlrpcerr['invalid_request'], |
| 590 | - PhpXmlRpc::$xmlrpcstr['invalid_request'] . ' ' . $xmlRpcParser->_xh['isf_reason']); |
|
| 590 | + PhpXmlRpc::$xmlrpcstr['invalid_request'].' '.$xmlRpcParser->_xh['isf_reason']); |
|
| 591 | 591 | } else { |
| 592 | 592 | // small layering violation in favor of speed and memory usage: we should allow the 'execute' method handle |
| 593 | 593 | // this, but in the most common scenario (xml-rpc values type server with some methods registered as phpvals) |
@@ -597,20 +597,20 @@ discard block |
||
| 597 | 597 | ($this->dmap[$xmlRpcParser->_xh['method']]['parameters_type'] != 'xmlrpcvals') |
| 598 | 598 | ) |
| 599 | 599 | ) { |
| 600 | - if ($this->debug > 1) { |
|
| 601 | - $this->debugmsg("\n+++PARSED+++\n" . var_export($xmlRpcParser->_xh['params'], true) . "\n+++END+++"); |
|
| 600 | + if ($this->debug>1) { |
|
| 601 | + $this->debugmsg("\n+++PARSED+++\n".var_export($xmlRpcParser->_xh['params'], true)."\n+++END+++"); |
|
| 602 | 602 | } |
| 603 | 603 | |
| 604 | 604 | return $this->execute($xmlRpcParser->_xh['method'], $xmlRpcParser->_xh['params'], $xmlRpcParser->_xh['pt']); |
| 605 | 605 | } else { |
| 606 | 606 | // build a Request object with data parsed from xml and add parameters in |
| 607 | 607 | $req = new Request($xmlRpcParser->_xh['method']); |
| 608 | - for ($i = 0; $i < count($xmlRpcParser->_xh['params']); $i++) { |
|
| 608 | + for ($i = 0; $i<count($xmlRpcParser->_xh['params']); $i++) { |
|
| 609 | 609 | $req->addParam($xmlRpcParser->_xh['params'][$i]); |
| 610 | 610 | } |
| 611 | 611 | |
| 612 | - if ($this->debug > 1) { |
|
| 613 | - $this->debugmsg("\n+++PARSED+++\n" . var_export($req, true) . "\n+++END+++"); |
|
| 612 | + if ($this->debug>1) { |
|
| 613 | + $this->debugmsg("\n+++PARSED+++\n".var_export($req, true)."\n+++END+++"); |
|
| 614 | 614 | } |
| 615 | 615 | |
| 616 | 616 | return $this->execute($req); |
@@ -662,7 +662,7 @@ discard block |
||
| 662 | 662 | return new Response( |
| 663 | 663 | 0, |
| 664 | 664 | PhpXmlRpc::$xmlrpcerr['incorrect_params'], |
| 665 | - PhpXmlRpc::$xmlrpcstr['incorrect_params'] . ": {$errStr}" |
|
| 665 | + PhpXmlRpc::$xmlrpcstr['incorrect_params'].": {$errStr}" |
|
| 666 | 666 | ); |
| 667 | 667 | } |
| 668 | 668 | } |
@@ -677,7 +677,7 @@ discard block |
||
| 677 | 677 | // build string representation of function 'name' |
| 678 | 678 | if (is_array($func)) { |
| 679 | 679 | if (is_object($func[0])) { |
| 680 | - $funcName = get_class($func[0]) . '->' . $func[1]; |
|
| 680 | + $funcName = get_class($func[0]).'->'.$func[1]; |
|
| 681 | 681 | } else { |
| 682 | 682 | $funcName = implode('::', $func); |
| 683 | 683 | } |
@@ -689,23 +689,23 @@ discard block |
||
| 689 | 689 | |
| 690 | 690 | // verify that function to be invoked is in fact callable |
| 691 | 691 | if (!is_callable($func)) { |
| 692 | - $this->getLogger()->error("XML-RPC: " . __METHOD__ . ": function '$funcName' registered as method handler is not callable"); |
|
| 692 | + $this->getLogger()->error("XML-RPC: ".__METHOD__.": function '$funcName' registered as method handler is not callable"); |
|
| 693 | 693 | return new Response( |
| 694 | 694 | 0, |
| 695 | 695 | PhpXmlRpc::$xmlrpcerr['server_error'], |
| 696 | - PhpXmlRpc::$xmlrpcstr['server_error'] . ": no function matches method" |
|
| 696 | + PhpXmlRpc::$xmlrpcstr['server_error'].": no function matches method" |
|
| 697 | 697 | ); |
| 698 | 698 | } |
| 699 | 699 | |
| 700 | 700 | if (isset($dmap[$methodName]['exception_handling'])) { |
| 701 | - $exception_handling = (int)$dmap[$methodName]['exception_handling']; |
|
| 701 | + $exception_handling = (int) $dmap[$methodName]['exception_handling']; |
|
| 702 | 702 | } else { |
| 703 | 703 | $exception_handling = $this->exception_handling; |
| 704 | 704 | } |
| 705 | 705 | |
| 706 | 706 | // If debug level is 3, we should catch all errors generated during processing of user function, and log them |
| 707 | 707 | // as part of response |
| 708 | - if ($this->debug > 2) { |
|
| 708 | + if ($this->debug>2) { |
|
| 709 | 709 | self::$_xmlrpcs_prev_ehandler = set_error_handler(array('\PhpXmlRpc\Server', '_xmlrpcs_errorHandler')); |
| 710 | 710 | } |
| 711 | 711 | |
@@ -719,14 +719,14 @@ discard block |
||
| 719 | 719 | $r = call_user_func($func, $req); |
| 720 | 720 | } |
| 721 | 721 | if (!is_a($r, 'PhpXmlRpc\Response')) { |
| 722 | - $this->getLogger()->error("XML-RPC: " . __METHOD__ . ": function '$funcName' registered as method handler does not return an xmlrpc response object but a " . gettype($r)); |
|
| 722 | + $this->getLogger()->error("XML-RPC: ".__METHOD__.": function '$funcName' registered as method handler does not return an xmlrpc response object but a ".gettype($r)); |
|
| 723 | 723 | if (is_a($r, 'PhpXmlRpc\Value')) { |
| 724 | 724 | $r = new Response($r); |
| 725 | 725 | } else { |
| 726 | 726 | $r = new Response( |
| 727 | 727 | 0, |
| 728 | 728 | PhpXmlRpc::$xmlrpcerr['server_error'], |
| 729 | - PhpXmlRpc::$xmlrpcstr['server_error'] . ": function does not return xmlrpc response object" |
|
| 729 | + PhpXmlRpc::$xmlrpcstr['server_error'].": function does not return xmlrpc response object" |
|
| 730 | 730 | ); |
| 731 | 731 | } |
| 732 | 732 | } |
@@ -741,7 +741,7 @@ discard block |
||
| 741 | 741 | $r = call_user_func_array($func, array($methodName, $params, $this->user_data)); |
| 742 | 742 | // mimic EPI behaviour: if we get an array that looks like an error, make it an error response |
| 743 | 743 | if (is_array($r) && array_key_exists('faultCode', $r) && array_key_exists('faultString', $r)) { |
| 744 | - $r = new Response(0, (integer)$r['faultCode'], (string)$r['faultString']); |
|
| 744 | + $r = new Response(0, (integer) $r['faultCode'], (string) $r['faultString']); |
|
| 745 | 745 | } else { |
| 746 | 746 | // functions using EPI api should NOT return resp objects, so make sure we encode the |
| 747 | 747 | // return type correctly |
@@ -766,7 +766,7 @@ discard block |
||
| 766 | 766 | // proper error-response |
| 767 | 767 | switch ($exception_handling) { |
| 768 | 768 | case 2: |
| 769 | - if ($this->debug > 2) { |
|
| 769 | + if ($this->debug>2) { |
|
| 770 | 770 | if (self::$_xmlrpcs_prev_ehandler) { |
| 771 | 771 | set_error_handler(self::$_xmlrpcs_prev_ehandler); |
| 772 | 772 | } else { |
@@ -789,7 +789,7 @@ discard block |
||
| 789 | 789 | // proper error-response |
| 790 | 790 | switch ($exception_handling) { |
| 791 | 791 | case 2: |
| 792 | - if ($this->debug > 2) { |
|
| 792 | + if ($this->debug>2) { |
|
| 793 | 793 | if (self::$_xmlrpcs_prev_ehandler) { |
| 794 | 794 | set_error_handler(self::$_xmlrpcs_prev_ehandler); |
| 795 | 795 | } else { |
@@ -809,7 +809,7 @@ discard block |
||
| 809 | 809 | } |
| 810 | 810 | } |
| 811 | 811 | |
| 812 | - if ($this->debug > 2) { |
|
| 812 | + if ($this->debug>2) { |
|
| 813 | 813 | // note: restore the error handler we found before calling the user func, even if it has been changed |
| 814 | 814 | // inside the func itself |
| 815 | 815 | if (self::$_xmlrpcs_prev_ehandler) { |
@@ -875,7 +875,7 @@ discard block |
||
| 875 | 875 | */ |
| 876 | 876 | protected function debugmsg($string) |
| 877 | 877 | { |
| 878 | - $this->debug_info .= $string . "\n"; |
|
| 878 | + $this->debug_info .= $string."\n"; |
|
| 879 | 879 | } |
| 880 | 880 | |
| 881 | 881 | /** |
@@ -885,9 +885,9 @@ discard block |
||
| 885 | 885 | protected function xml_header($charsetEncoding = '') |
| 886 | 886 | { |
| 887 | 887 | if ($charsetEncoding != '') { |
| 888 | - return "<?xml version=\"1.0\" encoding=\"$charsetEncoding\"?" . ">\n"; |
|
| 888 | + return "<?xml version=\"1.0\" encoding=\"$charsetEncoding\"?".">\n"; |
|
| 889 | 889 | } else { |
| 890 | - return "<?xml version=\"1.0\"?" . ">\n"; |
|
| 890 | + return "<?xml version=\"1.0\"?".">\n"; |
|
| 891 | 891 | } |
| 892 | 892 | } |
| 893 | 893 | |
@@ -1180,7 +1180,7 @@ discard block |
||
| 1180 | 1180 | $i++; // for error message, we count params from 1 |
| 1181 | 1181 | return static::_xmlrpcs_multicall_error(new Response(0, |
| 1182 | 1182 | PhpXmlRpc::$xmlrpcerr['incorrect_params'], |
| 1183 | - PhpXmlRpc::$xmlrpcstr['incorrect_params'] . ": probable xml error in param " . $i)); |
|
| 1183 | + PhpXmlRpc::$xmlrpcstr['incorrect_params'].": probable xml error in param ".$i)); |
|
| 1184 | 1184 | } |
| 1185 | 1185 | } |
| 1186 | 1186 | |
@@ -1261,7 +1261,7 @@ discard block |
||
| 1261 | 1261 | } |
| 1262 | 1262 | } else { |
| 1263 | 1263 | $numCalls = count($req); |
| 1264 | - for ($i = 0; $i < $numCalls; $i++) { |
|
| 1264 | + for ($i = 0; $i<$numCalls; $i++) { |
|
| 1265 | 1265 | $result[$i] = static::_xmlrpcs_multicall_do_call_phpvals($server, $req[$i]); |
| 1266 | 1266 | } |
| 1267 | 1267 | } |