@@ -75,7 +75,7 @@ |
||
| 75 | 75 | protected $maxChunkLength = 4194304; // 4 MB |
| 76 | 76 | |
| 77 | 77 | /** |
| 78 | - * @param array $options passed to the xml parser |
|
| 78 | + * @param string[] $options passed to the xml parser |
|
| 79 | 79 | */ |
| 80 | 80 | public function __construct(array $options = array()) |
| 81 | 81 | { |
@@ -130,10 +130,10 @@ discard block |
||
| 130 | 130 | ); |
| 131 | 131 | |
| 132 | 132 | $len = strlen($data); |
| 133 | - for ($offset = 0; $offset < $len; $offset += $this->maxChunkLength) { |
|
| 133 | + for ($offset = 0; $offset<$len; $offset += $this->maxChunkLength) { |
|
| 134 | 134 | $chunk = substr($data, $offset, $this->maxChunkLength); |
| 135 | 135 | // error handling: xml not well formed |
| 136 | - if (!xml_parse($parser, $chunk, $offset + $this->maxChunkLength >= $len)) { |
|
| 136 | + if (!xml_parse($parser, $chunk, $offset+$this->maxChunkLength>=$len)) { |
|
| 137 | 137 | $errCode = xml_get_error_code($parser); |
| 138 | 138 | $errStr = sprintf('XML error %s: %s at line %d, column %d', $errCode, xml_error_string($errCode), |
| 139 | 139 | xml_get_current_line_number($parser), xml_get_current_column_number($parser)); |
@@ -157,7 +157,7 @@ discard block |
||
| 157 | 157 | public function xmlrpc_se($parser, $name, $attrs, $acceptSingleVals = false) |
| 158 | 158 | { |
| 159 | 159 | // if invalid xmlrpc already detected, skip all processing |
| 160 | - if ($this->_xh['isf'] < 2) { |
|
| 160 | + if ($this->_xh['isf']<2) { |
|
| 161 | 161 | |
| 162 | 162 | // check for correct element nesting |
| 163 | 163 | if (count($this->_xh['stack']) == 0) { |
@@ -176,7 +176,7 @@ discard block |
||
| 176 | 176 | $this->_xh['rt'] = strtolower($name); |
| 177 | 177 | } else { |
| 178 | 178 | $this->_xh['isf'] = 2; |
| 179 | - $this->_xh['isf_reason'] = 'missing top level xmlrpc element. Found: ' . $name; |
|
| 179 | + $this->_xh['isf_reason'] = 'missing top level xmlrpc element. Found: '.$name; |
|
| 180 | 180 | |
| 181 | 181 | return; |
| 182 | 182 | } |
@@ -270,7 +270,7 @@ discard block |
||
| 270 | 270 | break; |
| 271 | 271 | case 'MEMBER': |
| 272 | 272 | // set member name to null, in case we do not find in the xml later on |
| 273 | - $this->_xh['valuestack'][count($this->_xh['valuestack']) - 1]['name'] = ''; |
|
| 273 | + $this->_xh['valuestack'][count($this->_xh['valuestack'])-1]['name'] = ''; |
|
| 274 | 274 | //$this->_xh['ac']=''; |
| 275 | 275 | // Drop trough intentionally |
| 276 | 276 | case 'PARAM': |
@@ -330,7 +330,7 @@ discard block |
||
| 330 | 330 | */ |
| 331 | 331 | public function xmlrpc_ee($parser, $name, $rebuildXmlrpcvals = true) |
| 332 | 332 | { |
| 333 | - if ($this->_xh['isf'] < 2) { |
|
| 333 | + if ($this->_xh['isf']<2) { |
|
| 334 | 334 | // push this element name from stack |
| 335 | 335 | // NB: if XML validates, correct opening/closing is guaranteed and |
| 336 | 336 | // we do not have to check for $name == $currElem. |
@@ -356,8 +356,8 @@ discard block |
||
| 356 | 356 | // check if we are inside an array or struct: |
| 357 | 357 | // if value just built is inside an array, let's move it into array on the stack |
| 358 | 358 | $vscount = count($this->_xh['valuestack']); |
| 359 | - if ($vscount && $this->_xh['valuestack'][$vscount - 1]['type'] == 'ARRAY') { |
|
| 360 | - $this->_xh['valuestack'][$vscount - 1]['values'][] = $temp; |
|
| 359 | + if ($vscount && $this->_xh['valuestack'][$vscount-1]['type'] == 'ARRAY') { |
|
| 360 | + $this->_xh['valuestack'][$vscount-1]['values'][] = $temp; |
|
| 361 | 361 | } else { |
| 362 | 362 | $this->_xh['value'] = $temp; |
| 363 | 363 | } |
@@ -371,8 +371,8 @@ discard block |
||
| 371 | 371 | // check if we are inside an array or struct: |
| 372 | 372 | // if value just built is inside an array, let's move it into array on the stack |
| 373 | 373 | $vscount = count($this->_xh['valuestack']); |
| 374 | - if ($vscount && $this->_xh['valuestack'][$vscount - 1]['type'] == 'ARRAY') { |
|
| 375 | - $this->_xh['valuestack'][$vscount - 1]['values'][] = $this->_xh['value']; |
|
| 374 | + if ($vscount && $this->_xh['valuestack'][$vscount-1]['type'] == 'ARRAY') { |
|
| 375 | + $this->_xh['valuestack'][$vscount-1]['values'][] = $this->_xh['value']; |
|
| 376 | 376 | } |
| 377 | 377 | } |
| 378 | 378 | break; |
@@ -392,7 +392,7 @@ discard block |
||
| 392 | 392 | $this->_xh['value'] = $this->_xh['ac']; |
| 393 | 393 | } elseif ($name == 'DATETIME.ISO8601') { |
| 394 | 394 | if (!preg_match('/^[0-9]{8}T[0-9]{2}:[0-9]{2}:[0-9]{2}$/', $this->_xh['ac'])) { |
| 395 | - error_log('XML-RPC: ' . __METHOD__ . ': invalid value received in DATETIME: ' . $this->_xh['ac']); |
|
| 395 | + error_log('XML-RPC: '.__METHOD__.': invalid value received in DATETIME: '.$this->_xh['ac']); |
|
| 396 | 396 | } |
| 397 | 397 | $this->_xh['vt'] = Value::$xmlrpcDateTime; |
| 398 | 398 | $this->_xh['value'] = $this->_xh['ac']; |
@@ -411,7 +411,7 @@ discard block |
||
| 411 | 411 | } else { |
| 412 | 412 | // log if receiving something strange, even though we set the value to false anyway |
| 413 | 413 | if ($this->_xh['ac'] != '0' && strcasecmp($this->_xh['ac'], 'false') != 0) { |
| 414 | - error_log('XML-RPC: ' . __METHOD__ . ': invalid value received in BOOLEAN: ' . $this->_xh['ac']); |
|
| 414 | + error_log('XML-RPC: '.__METHOD__.': invalid value received in BOOLEAN: '.$this->_xh['ac']); |
|
| 415 | 415 | } |
| 416 | 416 | $this->_xh['value'] = false; |
| 417 | 417 | } |
@@ -421,37 +421,37 @@ discard block |
||
| 421 | 421 | // NOTE: regexp could be much stricter than this... |
| 422 | 422 | if (!preg_match('/^[+-eE0123456789 \t.]+$/', $this->_xh['ac'])) { |
| 423 | 423 | /// @todo: find a better way of throwing an error than this! |
| 424 | - error_log('XML-RPC: ' . __METHOD__ . ': non numeric value received in DOUBLE: ' . $this->_xh['ac']); |
|
| 424 | + error_log('XML-RPC: '.__METHOD__.': non numeric value received in DOUBLE: '.$this->_xh['ac']); |
|
| 425 | 425 | $this->_xh['value'] = 'ERROR_NON_NUMERIC_FOUND'; |
| 426 | 426 | } else { |
| 427 | 427 | // it's ok, add it on |
| 428 | - $this->_xh['value'] = (double)$this->_xh['ac']; |
|
| 428 | + $this->_xh['value'] = (double) $this->_xh['ac']; |
|
| 429 | 429 | } |
| 430 | 430 | } else { |
| 431 | 431 | // we have an I4/I8/INT |
| 432 | 432 | // we must check that only 0123456789-<space> are characters here |
| 433 | 433 | if (!preg_match('/^[+-]?[0123456789 \t]+$/', $this->_xh['ac'])) { |
| 434 | 434 | /// @todo find a better way of throwing an error than this! |
| 435 | - error_log('XML-RPC: ' . __METHOD__ . ': non numeric value received in INT: ' . $this->_xh['ac']); |
|
| 435 | + error_log('XML-RPC: '.__METHOD__.': non numeric value received in INT: '.$this->_xh['ac']); |
|
| 436 | 436 | $this->_xh['value'] = 'ERROR_NON_NUMERIC_FOUND'; |
| 437 | 437 | } else { |
| 438 | 438 | // it's ok, add it on |
| 439 | - $this->_xh['value'] = (int)$this->_xh['ac']; |
|
| 439 | + $this->_xh['value'] = (int) $this->_xh['ac']; |
|
| 440 | 440 | } |
| 441 | 441 | } |
| 442 | 442 | $this->_xh['lv'] = 3; // indicate we've found a value |
| 443 | 443 | break; |
| 444 | 444 | case 'NAME': |
| 445 | - $this->_xh['valuestack'][count($this->_xh['valuestack']) - 1]['name'] = $this->_xh['ac']; |
|
| 445 | + $this->_xh['valuestack'][count($this->_xh['valuestack'])-1]['name'] = $this->_xh['ac']; |
|
| 446 | 446 | break; |
| 447 | 447 | case 'MEMBER': |
| 448 | 448 | // add to array in the stack the last element built, |
| 449 | 449 | // unless no VALUE was found |
| 450 | 450 | if ($this->_xh['vt']) { |
| 451 | 451 | $vscount = count($this->_xh['valuestack']); |
| 452 | - $this->_xh['valuestack'][$vscount - 1]['values'][$this->_xh['valuestack'][$vscount - 1]['name']] = $this->_xh['value']; |
|
| 452 | + $this->_xh['valuestack'][$vscount-1]['values'][$this->_xh['valuestack'][$vscount-1]['name']] = $this->_xh['value']; |
|
| 453 | 453 | } else { |
| 454 | - error_log('XML-RPC: ' . __METHOD__ . ': missing VALUE inside STRUCT in received xml'); |
|
| 454 | + error_log('XML-RPC: '.__METHOD__.': missing VALUE inside STRUCT in received xml'); |
|
| 455 | 455 | } |
| 456 | 456 | break; |
| 457 | 457 | case 'DATA': |
@@ -474,7 +474,7 @@ discard block |
||
| 474 | 474 | $this->_xh['params'][] = $this->_xh['value']; |
| 475 | 475 | $this->_xh['pt'][] = $this->_xh['vt']; |
| 476 | 476 | } else { |
| 477 | - error_log('XML-RPC: ' . __METHOD__ . ': missing VALUE inside PARAM in received xml'); |
|
| 477 | + error_log('XML-RPC: '.__METHOD__.': missing VALUE inside PARAM in received xml'); |
|
| 478 | 478 | } |
| 479 | 479 | break; |
| 480 | 480 | case 'METHODNAME': |
@@ -520,7 +520,7 @@ discard block |
||
| 520 | 520 | public function xmlrpc_cd($parser, $data) |
| 521 | 521 | { |
| 522 | 522 | // skip processing if xml fault already detected |
| 523 | - if ($this->_xh['isf'] < 2) { |
|
| 523 | + if ($this->_xh['isf']<2) { |
|
| 524 | 524 | // "lookforvalue==3" means that we've found an entire value |
| 525 | 525 | // and should discard any further character data |
| 526 | 526 | if ($this->_xh['lv'] != 3) { |
@@ -538,7 +538,7 @@ discard block |
||
| 538 | 538 | public function xmlrpc_dh($parser, $data) |
| 539 | 539 | { |
| 540 | 540 | // skip processing if xml fault already detected |
| 541 | - if ($this->_xh['isf'] < 2) { |
|
| 541 | + if ($this->_xh['isf']<2) { |
|
| 542 | 542 | if (substr($data, 0, 1) == '&' && substr($data, -1, 1) == ';') { |
| 543 | 543 | $this->_xh['ac'] .= $data; |
| 544 | 544 | } |
@@ -609,8 +609,8 @@ discard block |
||
| 609 | 609 | // Details: |
| 610 | 610 | // SPACE: (#x20 | #x9 | #xD | #xA)+ === [ \x9\xD\xA]+ |
| 611 | 611 | // EQ: SPACE?=SPACE? === [ \x9\xD\xA]*=[ \x9\xD\xA]* |
| 612 | - if (preg_match('/^<\?xml\s+version\s*=\s*' . "((?:\"[a-zA-Z0-9_.:-]+\")|(?:'[a-zA-Z0-9_.:-]+'))" . |
|
| 613 | - '\s+encoding\s*=\s*' . "((?:\"[A-Za-z][A-Za-z0-9._-]*\")|(?:'[A-Za-z][A-Za-z0-9._-]*'))/", |
|
| 612 | + if (preg_match('/^<\?xml\s+version\s*=\s*'."((?:\"[a-zA-Z0-9_.:-]+\")|(?:'[a-zA-Z0-9_.:-]+'))". |
|
| 613 | + '\s+encoding\s*=\s*'."((?:\"[A-Za-z][A-Za-z0-9._-]*\")|(?:'[A-Za-z][A-Za-z0-9._-]*'))/", |
|
| 614 | 614 | $xmlChunk, $matches)) { |
| 615 | 615 | return strtoupper(substr($matches[2], 1, -1)); |
| 616 | 616 | } |
@@ -628,7 +628,7 @@ discard block |
||
| 628 | 628 | // NB: mb_detect likes to call it ascii, xml parser likes to call it US_ASCII... |
| 629 | 629 | // IANA also likes better US-ASCII, so go with it |
| 630 | 630 | if ($enc == 'ASCII') { |
| 631 | - $enc = 'US-' . $enc; |
|
| 631 | + $enc = 'US-'.$enc; |
|
| 632 | 632 | } |
| 633 | 633 | |
| 634 | 634 | return $enc; |
@@ -663,8 +663,8 @@ discard block |
||
| 663 | 663 | // Details: |
| 664 | 664 | // SPACE: (#x20 | #x9 | #xD | #xA)+ === [ \x9\xD\xA]+ |
| 665 | 665 | // EQ: SPACE?=SPACE? === [ \x9\xD\xA]*=[ \x9\xD\xA]* |
| 666 | - if (preg_match('/^<\?xml\s+version\s*=\s*' . "((?:\"[a-zA-Z0-9_.:-]+\")|(?:'[a-zA-Z0-9_.:-]+'))" . |
|
| 667 | - '\s+encoding\s*=\s*' . "((?:\"[A-Za-z][A-Za-z0-9._-]*\")|(?:'[A-Za-z][A-Za-z0-9._-]*'))/", |
|
| 666 | + if (preg_match('/^<\?xml\s+version\s*=\s*'."((?:\"[a-zA-Z0-9_.:-]+\")|(?:'[a-zA-Z0-9_.:-]+'))". |
|
| 667 | + '\s+encoding\s*=\s*'."((?:\"[A-Za-z][A-Za-z0-9._-]*\")|(?:'[A-Za-z][A-Za-z0-9._-]*'))/", |
|
| 668 | 668 | $xmlChunk, $matches)) { |
| 669 | 669 | return true; |
| 670 | 670 | } |
@@ -10,13 +10,13 @@ discard block |
||
| 10 | 10 | <p></p> |
| 11 | 11 | <?php |
| 12 | 12 | |
| 13 | -include_once __DIR__ . "/../../src/Autoloader.php"; |
|
| 13 | +include_once __DIR__."/../../src/Autoloader.php"; |
|
| 14 | 14 | PhpXmlRpc\Autoloader::register(); |
| 15 | 15 | |
| 16 | 16 | $inAr = array("Dave" => 24, "Edd" => 45, "Joe" => 37, "Fred" => 27); |
| 17 | 17 | print "This is the input data:<br/><pre>"; |
| 18 | 18 | foreach ($inAr as $key => $val) { |
| 19 | - print $key . ", " . $val . "\n"; |
|
| 19 | + print $key.", ".$val."\n"; |
|
| 20 | 20 | } |
| 21 | 21 | print "</pre>"; |
| 22 | 22 | |
@@ -32,7 +32,7 @@ discard block |
||
| 32 | 32 | ); |
| 33 | 33 | } |
| 34 | 34 | $v = new PhpXmlRpc\Value($p, "array"); |
| 35 | -print "Encoded into xmlrpc format it looks like this: <pre>\n" . htmlentities($v->serialize()) . "</pre>\n"; |
|
| 35 | +print "Encoded into xmlrpc format it looks like this: <pre>\n".htmlentities($v->serialize())."</pre>\n"; |
|
| 36 | 36 | |
| 37 | 37 | // create client and message objects |
| 38 | 38 | $req = new PhpXmlRpc\Request('examples.sortByAge', array($v)); |
@@ -52,15 +52,15 @@ discard block |
||
| 52 | 52 | foreach ($value as $struct) { |
| 53 | 53 | $name = $struct["name"]; |
| 54 | 54 | $age = $struct["age"]; |
| 55 | - print htmlspecialchars($name->scalarval()) . ", " . htmlspecialchars($age->scalarval()) . "\n"; |
|
| 55 | + print htmlspecialchars($name->scalarval()).", ".htmlspecialchars($age->scalarval())."\n"; |
|
| 56 | 56 | } |
| 57 | 57 | |
| 58 | - print "<hr/>For nerds: I got this value back<br/><pre>" . |
|
| 59 | - htmlentities($resp->serialize()) . "</pre><hr/>\n"; |
|
| 58 | + print "<hr/>For nerds: I got this value back<br/><pre>". |
|
| 59 | + htmlentities($resp->serialize())."</pre><hr/>\n"; |
|
| 60 | 60 | } else { |
| 61 | 61 | print "An error occurred:<pre>"; |
| 62 | - print "Code: " . htmlspecialchars($resp->faultCode()) . |
|
| 63 | - "\nReason: '" . htmlspecialchars($resp->faultString()) . '\'</pre><hr/>'; |
|
| 62 | + print "Code: ".htmlspecialchars($resp->faultCode()). |
|
| 63 | + "\nReason: '".htmlspecialchars($resp->faultString()).'\'</pre><hr/>'; |
|
| 64 | 64 | } |
| 65 | 65 | |
| 66 | 66 | ?> |
@@ -39,10 +39,10 @@ |
||
| 39 | 39 | $flags = ENT_COMPAT; |
| 40 | 40 | // avoid warnings on php < 5.4... |
| 41 | 41 | if (defined('ENT_HTML401')) { |
| 42 | - $flags = $flags | ENT_HTML401; |
|
| 42 | + $flags = $flags | ENT_HTML401; |
|
| 43 | 43 | } |
| 44 | 44 | if (defined('ENT_SUBSTITUTE')) { |
| 45 | - $flags = $flags | ENT_SUBSTITUTE; |
|
| 45 | + $flags = $flags | ENT_SUBSTITUTE; |
|
| 46 | 46 | } |
| 47 | 47 | if ($encoding != null) { |
| 48 | 48 | print "<PRE>\n".htmlentities($message, $flags, $encoding)."\n</PRE>"; |
@@ -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 | - error_log('XML-RPC: ' . __METHOD__ . ': no response received from server.'); |
|
| 189 | + error_log('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 | |
@@ -255,7 +255,7 @@ discard block |
||
| 255 | 255 | if (extension_loaded('mbstring')) { |
| 256 | 256 | $data = mb_convert_encoding($data, 'UTF-8', $respEncoding); |
| 257 | 257 | } else { |
| 258 | - error_log('XML-RPC: ' . __METHOD__ . ': invalid charset encoding of received response: ' . $respEncoding); |
|
| 258 | + error_log('XML-RPC: '.__METHOD__.': invalid charset encoding of received response: '.$respEncoding); |
|
| 259 | 259 | } |
| 260 | 260 | } |
| 261 | 261 | } |
@@ -275,12 +275,12 @@ discard block |
||
| 275 | 275 | $xmlRpcParser->parse($data, $returnType, XMLParser::ACCEPT_RESPONSE); |
| 276 | 276 | |
| 277 | 277 | // first error check: xml not well formed |
| 278 | - if ($xmlRpcParser->_xh['isf'] > 2) { |
|
| 278 | + if ($xmlRpcParser->_xh['isf']>2) { |
|
| 279 | 279 | |
| 280 | 280 | // BC break: in the past for some cases we used the error message: 'XML error at line 1, check URL' |
| 281 | 281 | |
| 282 | 282 | $r = new Response(0, PhpXmlRpc::$xmlrpcerr['invalid_return'], |
| 283 | - PhpXmlRpc::$xmlrpcstr['invalid_return'] . ' ' . $xmlRpcParser->_xh['isf_reason']); |
|
| 283 | + PhpXmlRpc::$xmlrpcstr['invalid_return'].' '.$xmlRpcParser->_xh['isf_reason']); |
|
| 284 | 284 | |
| 285 | 285 | if ($this->debug) { |
| 286 | 286 | print $xmlRpcParser->_xh['isf_reason']; |
@@ -293,7 +293,7 @@ discard block |
||
| 293 | 293 | } |
| 294 | 294 | |
| 295 | 295 | $r = new Response(0, PhpXmlRpc::$xmlrpcerr['invalid_return'], |
| 296 | - PhpXmlRpc::$xmlrpcstr['invalid_return'] . ' ' . $xmlRpcParser->_xh['isf_reason']); |
|
| 296 | + PhpXmlRpc::$xmlrpcstr['invalid_return'].' '.$xmlRpcParser->_xh['isf_reason']); |
|
| 297 | 297 | } |
| 298 | 298 | // third error check: parsing of the response has somehow gone boink. |
| 299 | 299 | // NB: shall we omit this check, since we trust the parsing code? |
@@ -304,7 +304,7 @@ discard block |
||
| 304 | 304 | $r = new Response(0, PhpXmlRpc::$xmlrpcerr['invalid_return'], |
| 305 | 305 | PhpXmlRpc::$xmlrpcstr['invalid_return']); |
| 306 | 306 | } else { |
| 307 | - if ($this->debug > 1) { |
|
| 307 | + if ($this->debug>1) { |
|
| 308 | 308 | Logger::instance()->debugMessage( |
| 309 | 309 | "---PARSED---\n".var_export($xmlRpcParser->_xh['value'], true)."\n---END---" |
| 310 | 310 | ); |
@@ -152,7 +152,7 @@ discard block |
||
| 152 | 152 | */ |
| 153 | 153 | public static function xmlrpc_debugmsg($msg) |
| 154 | 154 | { |
| 155 | - static::$_xmlrpc_debuginfo .= $msg . "\n"; |
|
| 155 | + static::$_xmlrpc_debuginfo .= $msg."\n"; |
|
| 156 | 156 | } |
| 157 | 157 | |
| 158 | 158 | /** |
@@ -160,7 +160,7 @@ discard block |
||
| 160 | 160 | */ |
| 161 | 161 | public static function error_occurred($msg) |
| 162 | 162 | { |
| 163 | - static::$_xmlrpcs_occurred_errors .= $msg . "\n"; |
|
| 163 | + static::$_xmlrpcs_occurred_errors .= $msg."\n"; |
|
| 164 | 164 | } |
| 165 | 165 | |
| 166 | 166 | /** |
@@ -179,10 +179,10 @@ discard block |
||
| 179 | 179 | // user debug info should be encoded by the end user using the INTERNAL_ENCODING |
| 180 | 180 | $out = ''; |
| 181 | 181 | if ($this->debug_info != '') { |
| 182 | - $out .= "<!-- SERVER DEBUG INFO (BASE64 ENCODED):\n" . base64_encode($this->debug_info) . "\n-->\n"; |
|
| 182 | + $out .= "<!-- SERVER DEBUG INFO (BASE64 ENCODED):\n".base64_encode($this->debug_info)."\n-->\n"; |
|
| 183 | 183 | } |
| 184 | 184 | if (static::$_xmlrpc_debuginfo != '') { |
| 185 | - $out .= "<!-- DEBUG INFO:\n" . Charset::instance()->encodeEntities(str_replace('--', '_-', static::$_xmlrpc_debuginfo), PhpXmlRpc::$xmlrpc_internalencoding, $charsetEncoding) . "\n-->\n"; |
|
| 185 | + $out .= "<!-- DEBUG INFO:\n".Charset::instance()->encodeEntities(str_replace('--', '_-', static::$_xmlrpc_debuginfo), PhpXmlRpc::$xmlrpc_internalencoding, $charsetEncoding)."\n-->\n"; |
|
| 186 | 186 | // NB: a better solution MIGHT be to use CDATA, but we need to insert it |
| 187 | 187 | // into return payload AFTER the beginning tag |
| 188 | 188 | //$out .= "<![CDATA[ DEBUG INFO:\n\n" . str_replace(']]>', ']_]_>', static::$_xmlrpc_debuginfo) . "\n]]>\n"; |
@@ -212,8 +212,8 @@ discard block |
||
| 212 | 212 | $this->debug_info = ''; |
| 213 | 213 | |
| 214 | 214 | // Save what we received, before parsing it |
| 215 | - if ($this->debug > 1) { |
|
| 216 | - $this->debugmsg("+++GOT+++\n" . $data . "\n+++END+++"); |
|
| 215 | + if ($this->debug>1) { |
|
| 216 | + $this->debugmsg("+++GOT+++\n".$data."\n+++END+++"); |
|
| 217 | 217 | } |
| 218 | 218 | |
| 219 | 219 | $r = $this->parseRequestHeaders($data, $reqCharset, $respCharset, $respEncoding); |
@@ -225,14 +225,14 @@ discard block |
||
| 225 | 225 | // save full body of request into response, for more debugging usages |
| 226 | 226 | $r->raw_data = $rawData; |
| 227 | 227 | |
| 228 | - if ($this->debug > 2 && static::$_xmlrpcs_occurred_errors) { |
|
| 229 | - $this->debugmsg("+++PROCESSING ERRORS AND WARNINGS+++\n" . |
|
| 230 | - static::$_xmlrpcs_occurred_errors . "+++END+++"); |
|
| 228 | + if ($this->debug>2 && static::$_xmlrpcs_occurred_errors) { |
|
| 229 | + $this->debugmsg("+++PROCESSING ERRORS AND WARNINGS+++\n". |
|
| 230 | + static::$_xmlrpcs_occurred_errors."+++END+++"); |
|
| 231 | 231 | } |
| 232 | 232 | |
| 233 | 233 | $payload = $this->xml_header($respCharset); |
| 234 | - if ($this->debug > 0) { |
|
| 235 | - $payload = $payload . $this->serializeDebug($respCharset); |
|
| 234 | + if ($this->debug>0) { |
|
| 235 | + $payload = $payload.$this->serializeDebug($respCharset); |
|
| 236 | 236 | } |
| 237 | 237 | |
| 238 | 238 | // G. Giunta 2006-01-27: do not create response serialization if it has |
@@ -240,7 +240,7 @@ discard block |
||
| 240 | 240 | if (empty($r->payload)) { |
| 241 | 241 | $r->serialize($respCharset); |
| 242 | 242 | } |
| 243 | - $payload = $payload . $r->payload; |
|
| 243 | + $payload = $payload.$r->payload; |
|
| 244 | 244 | |
| 245 | 245 | if ($returnPayload) { |
| 246 | 246 | return $payload; |
@@ -249,7 +249,7 @@ discard block |
||
| 249 | 249 | // if we get a warning/error that has output some text before here, then we cannot |
| 250 | 250 | // add a new header. We cannot say we are sending xml, either... |
| 251 | 251 | if (!headers_sent()) { |
| 252 | - header('Content-Type: ' . $r->content_type); |
|
| 252 | + header('Content-Type: '.$r->content_type); |
|
| 253 | 253 | // we do not know if client actually told us an accepted charset, but if he did |
| 254 | 254 | // we have to tell him what we did |
| 255 | 255 | header("Vary: Accept-Charset"); |
@@ -275,10 +275,10 @@ discard block |
||
| 275 | 275 | // do not output content-length header if php is compressing output for us: |
| 276 | 276 | // it will mess up measurements |
| 277 | 277 | if ($phpNoSelfCompress) { |
| 278 | - header('Content-Length: ' . (int)strlen($payload)); |
|
| 278 | + header('Content-Length: '.(int) strlen($payload)); |
|
| 279 | 279 | } |
| 280 | 280 | } else { |
| 281 | - error_log('XML-RPC: ' . __METHOD__ . ': http headers already sent before response is fully generated. Check for php warning or error messages'); |
|
| 281 | + error_log('XML-RPC: '.__METHOD__.': http headers already sent before response is fully generated. Check for php warning or error messages'); |
|
| 282 | 282 | } |
| 283 | 283 | |
| 284 | 284 | print $payload; |
@@ -327,9 +327,9 @@ discard block |
||
| 327 | 327 | $numParams = count($in); |
| 328 | 328 | } |
| 329 | 329 | foreach ($sigs as $curSig) { |
| 330 | - if (count($curSig) == $numParams + 1) { |
|
| 330 | + if (count($curSig) == $numParams+1) { |
|
| 331 | 331 | $itsOK = 1; |
| 332 | - for ($n = 0; $n < $numParams; $n++) { |
|
| 332 | + for ($n = 0; $n<$numParams; $n++) { |
|
| 333 | 333 | if (is_object($in)) { |
| 334 | 334 | $p = $in->getParam($n); |
| 335 | 335 | if ($p->kindOf() == 'scalar') { |
@@ -342,10 +342,10 @@ discard block |
||
| 342 | 342 | } |
| 343 | 343 | |
| 344 | 344 | // param index is $n+1, as first member of sig is return type |
| 345 | - if ($pt != $curSig[$n + 1] && $curSig[$n + 1] != Value::$xmlrpcValue) { |
|
| 345 | + if ($pt != $curSig[$n+1] && $curSig[$n+1] != Value::$xmlrpcValue) { |
|
| 346 | 346 | $itsOK = 0; |
| 347 | - $pno = $n + 1; |
|
| 348 | - $wanted = $curSig[$n + 1]; |
|
| 347 | + $pno = $n+1; |
|
| 348 | + $wanted = $curSig[$n+1]; |
|
| 349 | 349 | $got = $pt; |
| 350 | 350 | break; |
| 351 | 351 | } |
@@ -372,10 +372,10 @@ discard block |
||
| 372 | 372 | // check if $_SERVER is populated: it might have been disabled via ini file |
| 373 | 373 | // (this is true even when in CLI mode) |
| 374 | 374 | if (count($_SERVER) == 0) { |
| 375 | - error_log('XML-RPC: ' . __METHOD__ . ': cannot parse request headers as $_SERVER is not populated'); |
|
| 375 | + error_log('XML-RPC: '.__METHOD__.': cannot parse request headers as $_SERVER is not populated'); |
|
| 376 | 376 | } |
| 377 | 377 | |
| 378 | - if ($this->debug > 1) { |
|
| 378 | + if ($this->debug>1) { |
|
| 379 | 379 | if (function_exists('getallheaders')) { |
| 380 | 380 | $this->debugmsg(''); // empty line |
| 381 | 381 | foreach (getallheaders() as $name => $val) { |
@@ -397,13 +397,13 @@ discard block |
||
| 397 | 397 | if (function_exists('gzinflate') && in_array($contentEncoding, $this->accepted_compression)) { |
| 398 | 398 | if ($contentEncoding == 'deflate' && $degzdata = @gzuncompress($data)) { |
| 399 | 399 | $data = $degzdata; |
| 400 | - if ($this->debug > 1) { |
|
| 401 | - $this->debugmsg("\n+++INFLATED REQUEST+++[" . strlen($data) . " chars]+++\n" . $data . "\n+++END+++"); |
|
| 400 | + if ($this->debug>1) { |
|
| 401 | + $this->debugmsg("\n+++INFLATED REQUEST+++[".strlen($data)." chars]+++\n".$data."\n+++END+++"); |
|
| 402 | 402 | } |
| 403 | 403 | } elseif ($contentEncoding == 'gzip' && $degzdata = @gzinflate(substr($data, 10))) { |
| 404 | 404 | $data = $degzdata; |
| 405 | - if ($this->debug > 1) { |
|
| 406 | - $this->debugmsg("+++INFLATED REQUEST+++[" . strlen($data) . " chars]+++\n" . $data . "\n+++END+++"); |
|
| 405 | + if ($this->debug>1) { |
|
| 406 | + $this->debugmsg("+++INFLATED REQUEST+++[".strlen($data)." chars]+++\n".$data."\n+++END+++"); |
|
| 407 | 407 | } |
| 408 | 408 | } else { |
| 409 | 409 | $r = new Response(0, PhpXmlRpc::$xmlrpcerr['server_decompress_fail'], PhpXmlRpc::$xmlrpcstr['server_decompress_fail']); |
@@ -487,7 +487,7 @@ discard block |
||
| 487 | 487 | if (extension_loaded('mbstring')) { |
| 488 | 488 | $data = mb_convert_encoding($data, 'UTF-8', $reqEncoding); |
| 489 | 489 | } else { |
| 490 | - error_log('XML-RPC: ' . __METHOD__ . ': invalid charset encoding of received request: ' . $reqEncoding); |
|
| 490 | + error_log('XML-RPC: '.__METHOD__.': invalid charset encoding of received request: '.$reqEncoding); |
|
| 491 | 491 | } |
| 492 | 492 | } |
| 493 | 493 | } |
@@ -505,16 +505,16 @@ discard block |
||
| 505 | 505 | |
| 506 | 506 | $xmlRpcParser = new XMLParser($options); |
| 507 | 507 | $xmlRpcParser->parse($data, $this->functions_parameters_type, XMLParser::ACCEPT_REQUEST); |
| 508 | - if ($xmlRpcParser->_xh['isf'] > 2) { |
|
| 508 | + if ($xmlRpcParser->_xh['isf']>2) { |
|
| 509 | 509 | // (BC) we return XML error as a faultCode |
| 510 | 510 | preg_match('/XML error [0-9]+/', $xmlRpcParser->_xh['isf_reason'], $matches); |
| 511 | 511 | $r = new Response(0, |
| 512 | - PhpXmlRpc::$xmlrpcerrxml + $matches[1], |
|
| 512 | + PhpXmlRpc::$xmlrpcerrxml+$matches[1], |
|
| 513 | 513 | $xmlRpcParser->_xh['isf_reason']); |
| 514 | 514 | } elseif ($xmlRpcParser->_xh['isf']) { |
| 515 | 515 | $r = new Response(0, |
| 516 | 516 | PhpXmlRpc::$xmlrpcerr['invalid_request'], |
| 517 | - PhpXmlRpc::$xmlrpcstr['invalid_request'] . ' ' . $xmlRpcParser->_xh['isf_reason']); |
|
| 517 | + PhpXmlRpc::$xmlrpcstr['invalid_request'].' '.$xmlRpcParser->_xh['isf_reason']); |
|
| 518 | 518 | } else { |
| 519 | 519 | // small layering violation in favor of speed and memory usage: |
| 520 | 520 | // we should allow the 'execute' method handle this, but in the |
@@ -525,20 +525,20 @@ discard block |
||
| 525 | 525 | ($this->dmap[$xmlRpcParser->_xh['method']]['parameters_type'] == 'phpvals') |
| 526 | 526 | ) |
| 527 | 527 | ) { |
| 528 | - if ($this->debug > 1) { |
|
| 529 | - $this->debugmsg("\n+++PARSED+++\n" . var_export($xmlRpcParser->_xh['params'], true) . "\n+++END+++"); |
|
| 528 | + if ($this->debug>1) { |
|
| 529 | + $this->debugmsg("\n+++PARSED+++\n".var_export($xmlRpcParser->_xh['params'], true)."\n+++END+++"); |
|
| 530 | 530 | } |
| 531 | 531 | $r = $this->execute($xmlRpcParser->_xh['method'], $xmlRpcParser->_xh['params'], $xmlRpcParser->_xh['pt']); |
| 532 | 532 | } else { |
| 533 | 533 | // build a Request object with data parsed from xml |
| 534 | 534 | $req = new Request($xmlRpcParser->_xh['method']); |
| 535 | 535 | // now add parameters in |
| 536 | - for ($i = 0; $i < count($xmlRpcParser->_xh['params']); $i++) { |
|
| 536 | + for ($i = 0; $i<count($xmlRpcParser->_xh['params']); $i++) { |
|
| 537 | 537 | $req->addParam($xmlRpcParser->_xh['params'][$i]); |
| 538 | 538 | } |
| 539 | 539 | |
| 540 | - if ($this->debug > 1) { |
|
| 541 | - $this->debugmsg("\n+++PARSED+++\n" . var_export($req, true) . "\n+++END+++"); |
|
| 540 | + if ($this->debug>1) { |
|
| 541 | + $this->debugmsg("\n+++PARSED+++\n".var_export($req, true)."\n+++END+++"); |
|
| 542 | 542 | } |
| 543 | 543 | $r = $this->execute($req); |
| 544 | 544 | } |
@@ -591,7 +591,7 @@ discard block |
||
| 591 | 591 | return new Response( |
| 592 | 592 | 0, |
| 593 | 593 | PhpXmlRpc::$xmlrpcerr['incorrect_params'], |
| 594 | - PhpXmlRpc::$xmlrpcstr['incorrect_params'] . ": ${errStr}" |
|
| 594 | + PhpXmlRpc::$xmlrpcstr['incorrect_params'].": ${errStr}" |
|
| 595 | 595 | ); |
| 596 | 596 | } |
| 597 | 597 | } |
@@ -604,7 +604,7 @@ discard block |
||
| 604 | 604 | |
| 605 | 605 | if (is_array($func)) { |
| 606 | 606 | if (is_object($func[0])) { |
| 607 | - $funcName = get_class($func[0]) . '->' . $func[1]; |
|
| 607 | + $funcName = get_class($func[0]).'->'.$func[1]; |
|
| 608 | 608 | } else { |
| 609 | 609 | $funcName = implode('::', $func); |
| 610 | 610 | } |
@@ -616,17 +616,17 @@ discard block |
||
| 616 | 616 | |
| 617 | 617 | // verify that function to be invoked is in fact callable |
| 618 | 618 | if (!is_callable($func)) { |
| 619 | - error_log("XML-RPC: " . __METHOD__ . ": function '$funcName' registered as method handler is not callable"); |
|
| 619 | + error_log("XML-RPC: ".__METHOD__.": function '$funcName' registered as method handler is not callable"); |
|
| 620 | 620 | return new Response( |
| 621 | 621 | 0, |
| 622 | 622 | PhpXmlRpc::$xmlrpcerr['server_error'], |
| 623 | - PhpXmlRpc::$xmlrpcstr['server_error'] . ": no function matches method" |
|
| 623 | + PhpXmlRpc::$xmlrpcstr['server_error'].": no function matches method" |
|
| 624 | 624 | ); |
| 625 | 625 | } |
| 626 | 626 | |
| 627 | 627 | // If debug level is 3, we should catch all errors generated during |
| 628 | 628 | // processing of user function, and log them as part of response |
| 629 | - if ($this->debug > 2) { |
|
| 629 | + if ($this->debug>2) { |
|
| 630 | 630 | self::$_xmlrpcs_prev_ehandler = set_error_handler(array('\PhpXmlRpc\Server', '_xmlrpcs_errorHandler')); |
| 631 | 631 | } |
| 632 | 632 | |
@@ -639,14 +639,14 @@ discard block |
||
| 639 | 639 | $r = call_user_func($func, $req); |
| 640 | 640 | } |
| 641 | 641 | if (!is_a($r, 'PhpXmlRpc\Response')) { |
| 642 | - error_log("XML-RPC: " . __METHOD__ . ": function '$funcName' registered as method handler does not return an xmlrpc response object but a " . gettype($r)); |
|
| 642 | + error_log("XML-RPC: ".__METHOD__.": function '$funcName' registered as method handler does not return an xmlrpc response object but a ".gettype($r)); |
|
| 643 | 643 | if (is_a($r, 'PhpXmlRpc\Value')) { |
| 644 | 644 | $r = new Response($r); |
| 645 | 645 | } else { |
| 646 | 646 | $r = new Response( |
| 647 | 647 | 0, |
| 648 | 648 | PhpXmlRpc::$xmlrpcerr['server_error'], |
| 649 | - PhpXmlRpc::$xmlrpcstr['server_error'] . ": function does not return xmlrpc response object" |
|
| 649 | + PhpXmlRpc::$xmlrpcstr['server_error'].": function does not return xmlrpc response object" |
|
| 650 | 650 | ); |
| 651 | 651 | } |
| 652 | 652 | } |
@@ -662,7 +662,7 @@ discard block |
||
| 662 | 662 | // mimic EPI behaviour: if we get an array that looks like an error, make it |
| 663 | 663 | // an eror response |
| 664 | 664 | if (is_array($r) && array_key_exists('faultCode', $r) && array_key_exists('faultString', $r)) { |
| 665 | - $r = new Response(0, (integer)$r['faultCode'], (string)$r['faultString']); |
|
| 665 | + $r = new Response(0, (integer) $r['faultCode'], (string) $r['faultString']); |
|
| 666 | 666 | } else { |
| 667 | 667 | // functions using EPI api should NOT return resp objects, |
| 668 | 668 | // so make sure we encode the return type correctly |
@@ -686,7 +686,7 @@ discard block |
||
| 686 | 686 | // in the called function, we wrap it in a proper error-response |
| 687 | 687 | switch ($this->exception_handling) { |
| 688 | 688 | case 2: |
| 689 | - if ($this->debug > 2) { |
|
| 689 | + if ($this->debug>2) { |
|
| 690 | 690 | if (self::$_xmlrpcs_prev_ehandler) { |
| 691 | 691 | set_error_handler(self::$_xmlrpcs_prev_ehandler); |
| 692 | 692 | } else { |
@@ -702,7 +702,7 @@ discard block |
||
| 702 | 702 | $r = new Response(0, PhpXmlRpc::$xmlrpcerr['server_error'], PhpXmlRpc::$xmlrpcstr['server_error']); |
| 703 | 703 | } |
| 704 | 704 | } |
| 705 | - if ($this->debug > 2) { |
|
| 705 | + if ($this->debug>2) { |
|
| 706 | 706 | // note: restore the error handler we found before calling the |
| 707 | 707 | // user func, even if it has been changed inside the func itself |
| 708 | 708 | if (self::$_xmlrpcs_prev_ehandler) { |
@@ -722,7 +722,7 @@ discard block |
||
| 722 | 722 | */ |
| 723 | 723 | protected function debugmsg($string) |
| 724 | 724 | { |
| 725 | - $this->debug_info .= $string . "\n"; |
|
| 725 | + $this->debug_info .= $string."\n"; |
|
| 726 | 726 | } |
| 727 | 727 | |
| 728 | 728 | /** |
@@ -732,9 +732,9 @@ discard block |
||
| 732 | 732 | protected function xml_header($charsetEncoding = '') |
| 733 | 733 | { |
| 734 | 734 | if ($charsetEncoding != '') { |
| 735 | - return "<?xml version=\"1.0\" encoding=\"$charsetEncoding\"?" . ">\n"; |
|
| 735 | + return "<?xml version=\"1.0\" encoding=\"$charsetEncoding\"?".">\n"; |
|
| 736 | 736 | } else { |
| 737 | - return "<?xml version=\"1.0\"?" . ">\n"; |
|
| 737 | + return "<?xml version=\"1.0\"?".">\n"; |
|
| 738 | 738 | } |
| 739 | 739 | } |
| 740 | 740 | |
@@ -967,12 +967,12 @@ discard block |
||
| 967 | 967 | } |
| 968 | 968 | |
| 969 | 969 | $req = new Request($methName->scalarval()); |
| 970 | - foreach($params as $i => $param) { |
|
| 970 | + foreach ($params as $i => $param) { |
|
| 971 | 971 | if (!$req->addParam($param)) { |
| 972 | 972 | $i++; // for error message, we count params from 1 |
| 973 | 973 | return static::_xmlrpcs_multicall_error(new Response(0, |
| 974 | 974 | PhpXmlRpc::$xmlrpcerr['incorrect_params'], |
| 975 | - PhpXmlRpc::$xmlrpcstr['incorrect_params'] . ": probable xml error in param " . $i)); |
|
| 975 | + PhpXmlRpc::$xmlrpcstr['incorrect_params'].": probable xml error in param ".$i)); |
|
| 976 | 976 | } |
| 977 | 977 | } |
| 978 | 978 | |
@@ -1039,12 +1039,12 @@ discard block |
||
| 1039 | 1039 | // let accept a plain list of php parameters, beside a single xmlrpc msg object |
| 1040 | 1040 | if (is_object($req)) { |
| 1041 | 1041 | $calls = $req->getParam(0); |
| 1042 | - foreach($calls as $call) { |
|
| 1042 | + foreach ($calls as $call) { |
|
| 1043 | 1043 | $result[] = static::_xmlrpcs_multicall_do_call($server, $call); |
| 1044 | 1044 | } |
| 1045 | 1045 | } else { |
| 1046 | 1046 | $numCalls = count($req); |
| 1047 | - for ($i = 0; $i < $numCalls; $i++) { |
|
| 1047 | + for ($i = 0; $i<$numCalls; $i++) { |
|
| 1048 | 1048 | $result[$i] = static::_xmlrpcs_multicall_do_call_phpvals($server, $req[$i]); |
| 1049 | 1049 | } |
| 1050 | 1050 | } |
@@ -76,7 +76,7 @@ discard block |
||
| 76 | 76 | return $xmlrpcVal->scalarval(); |
| 77 | 77 | case 'array': |
| 78 | 78 | $arr = array(); |
| 79 | - foreach($xmlrpcVal as $value) { |
|
| 79 | + foreach ($xmlrpcVal as $value) { |
|
| 80 | 80 | $arr[] = $this->decode($value, $options); |
| 81 | 81 | } |
| 82 | 82 | |
@@ -106,7 +106,7 @@ discard block |
||
| 106 | 106 | case 'msg': |
| 107 | 107 | $paramCount = $xmlrpcVal->getNumParams(); |
| 108 | 108 | $arr = array(); |
| 109 | - for ($i = 0; $i < $paramCount; $i++) { |
|
| 109 | + for ($i = 0; $i<$paramCount; $i++) { |
|
| 110 | 110 | $arr[] = $this->decode($xmlrpcVal->getParam($i), $options); |
| 111 | 111 | } |
| 112 | 112 | |
@@ -184,7 +184,7 @@ discard block |
||
| 184 | 184 | $xmlrpcVal = new Value($phpVal->format('Ymd\TH:i:s'), Value::$xmlrpcStruct); |
| 185 | 185 | } else { |
| 186 | 186 | $arr = array(); |
| 187 | - foreach($phpVal as $k => $v) { |
|
| 187 | + foreach ($phpVal as $k => $v) { |
|
| 188 | 188 | $arr[$k] = $this->encode($v, $options); |
| 189 | 189 | } |
| 190 | 190 | $xmlrpcVal = new Value($arr, Value::$xmlrpcStruct); |
@@ -206,7 +206,7 @@ discard block |
||
| 206 | 206 | break; |
| 207 | 207 | case 'resource': |
| 208 | 208 | if (in_array('extension_api', $options)) { |
| 209 | - $xmlrpcVal = new Value((int)$phpVal, Value::$xmlrpcInt); |
|
| 209 | + $xmlrpcVal = new Value((int) $phpVal, Value::$xmlrpcInt); |
|
| 210 | 210 | } else { |
| 211 | 211 | $xmlrpcVal = new Value(); |
| 212 | 212 | } |
@@ -251,7 +251,7 @@ discard block |
||
| 251 | 251 | if (extension_loaded('mbstring')) { |
| 252 | 252 | $xmlVal = mb_convert_encoding($xmlVal, 'UTF-8', $valEncoding); |
| 253 | 253 | } else { |
| 254 | - error_log('XML-RPC: ' . __METHOD__ . ': invalid charset encoding of xml text: ' . $valEncoding); |
|
| 254 | + error_log('XML-RPC: '.__METHOD__.': invalid charset encoding of xml text: '.$valEncoding); |
|
| 255 | 255 | } |
| 256 | 256 | } |
| 257 | 257 | } |
@@ -267,7 +267,7 @@ discard block |
||
| 267 | 267 | $xmlRpcParser = new XMLParser($options); |
| 268 | 268 | $xmlRpcParser->parse($xmlVal, XMLParser::RETURN_XMLRPCVALS, XMLParser::ACCEPT_REQUEST | XMLParser::ACCEPT_RESPONSE | XMLParser::ACCEPT_VALUE); |
| 269 | 269 | |
| 270 | - if ($xmlRpcParser->_xh['isf'] > 1) { |
|
| 270 | + if ($xmlRpcParser->_xh['isf']>1) { |
|
| 271 | 271 | // test that $xmlrpc->_xh['value'] is an obj, too??? |
| 272 | 272 | |
| 273 | 273 | error_log($xmlRpcParser->_xh['isf_reason']); |
@@ -291,7 +291,7 @@ discard block |
||
| 291 | 291 | return $r; |
| 292 | 292 | case 'methodcall': |
| 293 | 293 | $req = new Request($xmlRpcParser->_xh['method']); |
| 294 | - for ($i = 0; $i < count($xmlRpcParser->_xh['params']); $i++) { |
|
| 294 | + for ($i = 0; $i<count($xmlRpcParser->_xh['params']); $i++) { |
|
| 295 | 295 | $req->addParam($xmlRpcParser->_xh['params'][$i]); |
| 296 | 296 | } |
| 297 | 297 | |