Passed
Push — master ( 2d5b6d...8a7d5c )
by Gaetano
11:38
created
demo/client/which.php 1 patch
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -1,5 +1,5 @@  discard block
 block discarded – undo
1 1
 <?php
2
-require_once __DIR__ . "/_prepend.php";
2
+require_once __DIR__."/_prepend.php";
3 3
 
4 4
 output('<html lang="en">
5 5
 <head><title>phpxmlrpc - Which toolkit demo</title></head>
@@ -19,7 +19,7 @@  discard block
 block discarded – undo
19 19
     <methodName>interopEchoTests.whichToolkit</methodName>
20 20
     <params/>
21 21
 </methodCall>';
22
-output("XML custom request:<br/><pre>" . htmlspecialchars($payload) . "</pre>\n");
22
+output("XML custom request:<br/><pre>".htmlspecialchars($payload)."</pre>\n");
23 23
 
24 24
 $client = new Client(XMLRPCSERVER);
25 25
 
@@ -40,7 +40,7 @@  discard block
 block discarded – undo
40 40
 if (!$resp->faultCode()) {
41 41
 
42 42
     $xml = $resp->value();
43
-    output("XML response:<br/><pre>" . htmlspecialchars($xml) . "</pre>\n");
43
+    output("XML response:<br/><pre>".htmlspecialchars($xml)."</pre>\n");
44 44
 
45 45
     $encoder = new Encoder();
46 46
     // from xml to xml-rpc Response
@@ -52,14 +52,14 @@  discard block
 block discarded – undo
52 52
 
53 53
     output("Toolkit info:<br/>\n");
54 54
     output("<pre>");
55
-    output("name: " . htmlspecialchars($value["toolkitName"]) . "\n");
56
-    output("version: " . htmlspecialchars($value["toolkitVersion"]) . "\n");
57
-    output("docs: " . htmlspecialchars($value["toolkitDocsUrl"]) . "\n");
58
-    output("os: " . htmlspecialchars($value["toolkitOperatingSystem"]) . "\n");
55
+    output("name: ".htmlspecialchars($value["toolkitName"])."\n");
56
+    output("version: ".htmlspecialchars($value["toolkitVersion"])."\n");
57
+    output("docs: ".htmlspecialchars($value["toolkitDocsUrl"])."\n");
58
+    output("os: ".htmlspecialchars($value["toolkitOperatingSystem"])."\n");
59 59
     output("</pre>");
60 60
 } else {
61 61
     output("An error occurred: ");
62
-    output("Code: " . htmlspecialchars($resp->faultCode()) . " Reason: '" . htmlspecialchars($resp->faultString()) . "'\n");
62
+    output("Code: ".htmlspecialchars($resp->faultCode())." Reason: '".htmlspecialchars($resp->faultString())."'\n");
63 63
 }
64 64
 
65 65
 output("</body></html>\n");
Please login to merge, or discard this patch.
demo/client/getstatename.php 1 patch
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -1,5 +1,5 @@  discard block
 block discarded – undo
1 1
 <?php
2
-require_once __DIR__ . "/_prepend.php";
2
+require_once __DIR__."/_prepend.php";
3 3
 
4 4
 output('<html lang="en">
5 5
 <head><title>phpxmlrpc - Getstatename demo</title></head>
@@ -17,13 +17,13 @@  discard block
 block discarded – undo
17 17
 $stateNo = "";
18 18
 
19 19
 if (isset($_POST['stateno']) && $_POST['stateno'] != "") {
20
-    $stateNo = (integer)$_POST['stateno'];
20
+    $stateNo = (integer) $_POST['stateno'];
21 21
     $method = 'examples.getStateName';
22 22
     $arguments = array(
23 23
         new Value($stateNo, Value::$xmlrpcInt),
24 24
     );
25 25
     $req = new Request($method, $arguments);
26
-    output("Sending the following request:<pre>\n\n" . htmlentities($req->serialize()) .
26
+    output("Sending the following request:<pre>\n\n".htmlentities($req->serialize()).
27 27
         "\n\n</pre>Debug info of server data follows...\n\n");
28 28
     $client = new Client(XMLRPCSERVER);
29 29
     $client->setDebug(1);
@@ -32,12 +32,12 @@  discard block
 block discarded – undo
32 32
         $val = $resp->value();
33 33
         // NB: we are _assuming_ that the server did return a scalar xml-rpc value here.
34 34
         // If the server is not trusted, we might check that via `$val->kindOf() == 'scalar'`
35
-        output('<br/>State number <b>' . $stateNo . '</b> is <b>'
36
-            . htmlspecialchars($val->scalarval()) . '</b><br/><br/>');
35
+        output('<br/>State number <b>'.$stateNo.'</b> is <b>'
36
+            . htmlspecialchars($val->scalarval()).'</b><br/><br/>');
37 37
     } else {
38 38
         output('An error occurred: ');
39
-        output('<pre>Code: ' . htmlspecialchars($resp->faultCode())
40
-            . " Reason: '" . htmlspecialchars($resp->faultString()) . "'</pre>");
39
+        output('<pre>Code: '.htmlspecialchars($resp->faultCode())
40
+            . " Reason: '".htmlspecialchars($resp->faultString())."'</pre>");
41 41
     }
42 42
 }
43 43
 
Please login to merge, or discard this patch.
demo/client/proxy.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -1,5 +1,5 @@
 block discarded – undo
1 1
 <?php
2
-require_once __DIR__ . "/_prepend.php";
2
+require_once __DIR__."/_prepend.php";
3 3
 
4 4
 output('<html lang="en">
5 5
 <head><title>phpxmlrpc - Proxy demo</title></head>
Please login to merge, or discard this patch.
demo/client/wrap.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -1,5 +1,5 @@  discard block
 block discarded – undo
1 1
 <?php
2
-require_once __DIR__ . "/_prepend.php";
2
+require_once __DIR__."/_prepend.php";
3 3
 
4 4
 output('<html lang="en">
5 5
 <head><title>phpxmlrpc - Webservice wrapper demo</title></head>
@@ -20,7 +20,7 @@  discard block
 block discarded – undo
20 20
 $client->return_type = 'phpvals'; // let client give us back php values instead of xmlrpcvals
21 21
 $resp = $client->send(new PhpXmlRpc\Request('system.listMethods'));
22 22
 if ($resp->faultCode()) {
23
-    output("<p>Server methods list could not be retrieved: error {$resp->faultCode()} '" . htmlspecialchars($resp->faultString()) . "'</p>\n");
23
+    output("<p>Server methods list could not be retrieved: error {$resp->faultCode()} '".htmlspecialchars($resp->faultString())."'</p>\n");
24 24
 } else {
25 25
     output("<p>Server methods list retrieved, now wrapping it up...</p>\n<ul>\n");
26 26
     flush();
@@ -32,9 +32,9 @@  discard block
 block discarded – undo
32 32
         if ($methodName == 'examples.getStateName') {
33 33
             $callable = $wrapper->wrapXmlrpcMethod($client, $methodName);
34 34
             if ($callable) {
35
-                output("<li>Remote server method " . htmlspecialchars($methodName) . " wrapped into php function</li>\n");
35
+                output("<li>Remote server method ".htmlspecialchars($methodName)." wrapped into php function</li>\n");
36 36
             } else {
37
-                output("<li>Remote server method " . htmlspecialchars($methodName) . " could not be wrapped!</li>\n");
37
+                output("<li>Remote server method ".htmlspecialchars($methodName)." could not be wrapped!</li>\n");
38 38
             }
39 39
             break;
40 40
         }
Please login to merge, or discard this patch.
demo/client/agesort.php 1 patch
Spacing   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -1,5 +1,5 @@  discard block
 block discarded – undo
1 1
 <?php
2
-require_once __DIR__ . "/_prepend.php";
2
+require_once __DIR__."/_prepend.php";
3 3
 
4 4
 output('<html lang="en">
5 5
 <head><title>phpxmlrpc - Agesort demo</title></head>
@@ -17,21 +17,21 @@  discard block
 block discarded – undo
17 17
 
18 18
 $inAr = array(
19 19
     array('name' => 'Dave', 'age' => 24),
20
-    array('name' => 'Edd',  'age' => 45),
21
-    array('name' => 'Joe',  'age' => 37),
20
+    array('name' => 'Edd', 'age' => 45),
21
+    array('name' => 'Joe', 'age' => 37),
22 22
     array('name' => 'Fred', 'age' => 27),
23 23
 );
24 24
 
25 25
 output('This is the input data:<br/><pre>');
26 26
 foreach ($inAr as $val) {
27
-    output($val['name'] . ", " . $val['age'] . "\n");
27
+    output($val['name'].", ".$val['age']."\n");
28 28
 }
29 29
 output('</pre>');
30 30
 
31 31
 // Create xml-rpc parameters from the input array: an array of structs
32 32
 $encoder = new Encoder();
33 33
 $v = $encoder->encode($inAr);
34
-output("Encoded into xml-rpc format it looks like this: <pre>\n" . htmlentities($v->serialize()) . "</pre>\n");
34
+output("Encoded into xml-rpc format it looks like this: <pre>\n".htmlentities($v->serialize())."</pre>\n");
35 35
 
36 36
 // create client and request objects
37 37
 $req = new Request('examples.sortByAge', array($v));
@@ -51,15 +51,15 @@  discard block
 block discarded – undo
51 51
     $value = $resp->value();
52 52
     foreach ($encoder->decode($value) as $struct) {
53 53
         // note: here we are trusting the server's response to have the expected format
54
-        output(htmlspecialchars($struct['name']) . ", " . htmlspecialchars($struct['age']) . "\n");
54
+        output(htmlspecialchars($struct['name']).", ".htmlspecialchars($struct['age'])."\n");
55 55
     }
56 56
 
57
-    output('</pre><hr/>For nerds: I got this value back<br/><pre>' .
58
-        htmlentities($resp->serialize()) . "</pre><hr/>\n");
57
+    output('</pre><hr/>For nerds: I got this value back<br/><pre>'.
58
+        htmlentities($resp->serialize())."</pre><hr/>\n");
59 59
 } else {
60 60
     output('An error occurred:<pre>');
61
-    output('Code: ' . htmlspecialchars($resp->faultCode()) .
62
-        "\nReason: '" . htmlspecialchars($resp->faultString()) . "'</pre><hr/>");
61
+    output('Code: '.htmlspecialchars($resp->faultCode()).
62
+        "\nReason: '".htmlspecialchars($resp->faultString())."'</pre><hr/>");
63 63
 }
64 64
 
65 65
 output("</body></html>\n");
Please login to merge, or discard this patch.
demo/client/introspect.php 1 patch
Spacing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -1,5 +1,5 @@  discard block
 block discarded – undo
1 1
 <?php
2
-require_once __DIR__ . "/_prepend.php";
2
+require_once __DIR__."/_prepend.php";
3 3
 
4 4
 output('<html lang="en">
5 5
 <head><title>phpxmlrpc - Introspect demo</title></head>
@@ -17,7 +17,7 @@  discard block
 block discarded – undo
17 17
 function display_error($r)
18 18
 {
19 19
     output("An error occurred: ");
20
-    output("Code: " . $r->faultCode() . " Reason: '" . $r->faultString() . "'<br/>");
20
+    output("Code: ".$r->faultCode()." Reason: '".$r->faultString()."'<br/>");
21 21
 }
22 22
 
23 23
 $client = new Client(XMLRPCSERVER);
@@ -25,7 +25,7 @@  discard block
 block discarded – undo
25 25
 $client->return_type = XMLRPCParser::RETURN_PHP;
26 26
 
27 27
 // First off, let's retrieve the list of methods available on the remote server
28
-output("<h3>methods available at http://" . $client->server . $client->path . "</h3>\n");
28
+output("<h3>methods available at http://".$client->server.$client->path."</h3>\n");
29 29
 $req = new Request('system.listMethods');
30 30
 $resp = $client->send($req);
31 31
 
@@ -47,7 +47,7 @@  discard block
 block discarded – undo
47 47
 
48 48
     // Then, retrieve the signature and help text of each available method
49 49
     foreach ($v as $methodName) {
50
-        output("<h4>" . htmlspecialchars($methodName) . "</h4>\n");
50
+        output("<h4>".htmlspecialchars($methodName)."</h4>\n");
51 51
         // build requests first, add params later
52 52
         $r1 = new PhpXmlRpc\Request('system.methodHelp');
53 53
         $r2 = new PhpXmlRpc\Request('system.methodSignature');
@@ -83,12 +83,12 @@  discard block
 block discarded – undo
83 83
                         continue;
84 84
                     }
85 85
                     $ret = $sig[0];
86
-                    output("<code>" . htmlspecialchars($ret) . " "
87
-                        . htmlspecialchars($methodName) . "(");
88
-                    if (count($sig) > 1) {
89
-                        for ($k = 1; $k < count($sig); $k++) {
86
+                    output("<code>".htmlspecialchars($ret)." "
87
+                        . htmlspecialchars($methodName)."(");
88
+                    if (count($sig)>1) {
89
+                        for ($k = 1; $k<count($sig); $k++) {
90 90
                             output(htmlspecialchars($sig[$k]));
91
-                            if ($k < count($sig) - 1) {
91
+                            if ($k<count($sig)-1) {
92 92
                                 output(", ");
93 93
                             }
94 94
                         }
Please login to merge, or discard this patch.
demo/server/proxy.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -15,7 +15,7 @@  discard block
 block discarded – undo
15 15
  * @license code licensed under the BSD License: see file license.txt
16 16
  */
17 17
 
18
-require_once __DIR__ . "/_prepend.php";
18
+require_once __DIR__."/_prepend.php";
19 19
 
20 20
 // *** NB: WE BLOCK THIS FROM RUNNING BY DEFAULT IN CASE ACCESS IS GRANTED TO IT IN PRODUCTION BY MISTAKE ***
21 21
 // Comment out the following safeguard if you want to use it as is, but remember: this is an open relay !!!
@@ -46,7 +46,7 @@  discard block
 block discarded – undo
46 46
     //            fe. any url using the 'file://' protocol might be considered a hacking attempt
47 47
     $client = new Client($url);
48 48
 
49
-    if ($req->getNumParams() > 3) {
49
+    if ($req->getNumParams()>3) {
50 50
         // we have to set some options onto the client.
51 51
         // Note that if we do not untaint the received values, warnings might be generated...
52 52
         $options = $encoder->decode($req->getParam(3));
@@ -68,7 +68,7 @@  discard block
 block discarded – undo
68 68
                     $client->setSSLVerifyPeer($val);
69 69
                     break;
70 70
                 case 'Timeout':
71
-                    $timeout = (integer)$val;
71
+                    $timeout = (integer) $val;
72 72
                     break;
73 73
             } // switch
74 74
         }
@@ -81,7 +81,7 @@  discard block
 block discarded – undo
81 81
     ///         X-forwarded-for anyway, unless they consider this server as trusted...)
82 82
     $reqMethod = $req->getParam(1)->scalarval();
83 83
     $req = new Request($reqMethod);
84
-    if ($req->getNumParams() > 1) {
84
+    if ($req->getNumParams()>1) {
85 85
         $pars = $req->getParam(2);
86 86
         foreach ($pars as $par) {
87 87
             $req->addParam($par);
@@ -89,7 +89,7 @@  discard block
 block discarded – undo
89 89
     }
90 90
 
91 91
     // add debug info into response we give back to caller
92
-    Server::xmlrpc_debugmsg("Sending to server $url the payload: " . $req->serialize());
92
+    Server::xmlrpc_debugmsg("Sending to server $url the payload: ".$req->serialize());
93 93
 
94 94
     return $client->send($req, $timeout);
95 95
 }
Please login to merge, or discard this patch.
src/Server.php 1 patch
Spacing   +51 added lines, -51 removed lines patch added patch discarded remove patch
@@ -233,7 +233,7 @@  discard block
 block discarded – undo
233 233
      */
234 234
     public static function xmlrpc_debugmsg($msg)
235 235
     {
236
-        static::$_xmlrpc_debuginfo .= $msg . "\n";
236
+        static::$_xmlrpc_debuginfo .= $msg."\n";
237 237
     }
238 238
 
239 239
     /**
@@ -245,7 +245,7 @@  discard block
 block discarded – undo
245 245
      */
246 246
     public static function error_occurred($msg)
247 247
     {
248
-        static::$_xmlrpcs_occurred_errors .= $msg . "\n";
248
+        static::$_xmlrpcs_occurred_errors .= $msg."\n";
249 249
     }
250 250
 
251 251
     /**
@@ -266,10 +266,10 @@  discard block
 block discarded – undo
266 266
         // user debug info should be encoded by the end user using the INTERNAL_ENCODING
267 267
         $out = '';
268 268
         if ($this->debug_info != '') {
269
-            $out .= "<!-- SERVER DEBUG INFO (BASE64 ENCODED):\n" . base64_encode($this->debug_info) . "\n-->\n";
269
+            $out .= "<!-- SERVER DEBUG INFO (BASE64 ENCODED):\n".base64_encode($this->debug_info)."\n-->\n";
270 270
         }
271 271
         if (static::$_xmlrpc_debuginfo != '') {
272
-            $out .= "<!-- DEBUG INFO:\n" . $this->getCharsetEncoder()->encodeEntities(str_replace('--', '_-', static::$_xmlrpc_debuginfo), PhpXmlRpc::$xmlrpc_internalencoding, $charsetEncoding) . "\n-->\n";
272
+            $out .= "<!-- DEBUG INFO:\n".$this->getCharsetEncoder()->encodeEntities(str_replace('--', '_-', static::$_xmlrpc_debuginfo), PhpXmlRpc::$xmlrpc_internalencoding, $charsetEncoding)."\n-->\n";
273 273
             // NB: a better solution MIGHT be to use CDATA, but we need to insert it
274 274
             // into return payload AFTER the beginning tag
275 275
             //$out .= "<![CDATA[ DEBUG INFO:\n\n" . str_replace(']]>', ']_]_>', static::$_xmlrpc_debuginfo) . "\n]]>\n";
@@ -298,8 +298,8 @@  discard block
 block discarded – undo
298 298
         $this->debug_info = '';
299 299
 
300 300
         // Save what we received, before parsing it
301
-        if ($this->debug > 1) {
302
-            $this->debugmsg("+++GOT+++\n" . $data . "\n+++END+++");
301
+        if ($this->debug>1) {
302
+            $this->debugmsg("+++GOT+++\n".$data."\n+++END+++");
303 303
         }
304 304
 
305 305
         $r = $this->parseRequestHeaders($data, $reqCharset, $respCharset, $respEncoding);
@@ -313,21 +313,21 @@  discard block
 block discarded – undo
313 313
             $r->raw_data = $rawData;
314 314
         }
315 315
 
316
-        if ($this->debug > 2 && static::$_xmlrpcs_occurred_errors != '') {
317
-            $this->debugmsg("+++PROCESSING ERRORS AND WARNINGS+++\n" .
318
-                static::$_xmlrpcs_occurred_errors . "+++END+++");
316
+        if ($this->debug>2 && static::$_xmlrpcs_occurred_errors != '') {
317
+            $this->debugmsg("+++PROCESSING ERRORS AND WARNINGS+++\n".
318
+                static::$_xmlrpcs_occurred_errors."+++END+++");
319 319
         }
320 320
 
321 321
         $payload = $this->xml_header($respCharset);
322
-        if ($this->debug > 0) {
323
-            $payload = $payload . $this->serializeDebug($respCharset);
322
+        if ($this->debug>0) {
323
+            $payload = $payload.$this->serializeDebug($respCharset);
324 324
         }
325 325
 
326 326
         // Do not create response serialization if it has already happened. Helps building json magic
327 327
         if (empty($r->payload)) {
328 328
             $r->serialize($respCharset);
329 329
         }
330
-        $payload = $payload . $r->payload;
330
+        $payload = $payload.$r->payload;
331 331
 
332 332
         if ($returnPayload) {
333 333
             return $payload;
@@ -336,7 +336,7 @@  discard block
 block discarded – undo
336 336
         // if we get a warning/error that has output some text before here, then we cannot
337 337
         // add a new header. We cannot say we are sending xml, either...
338 338
         if (!headers_sent()) {
339
-            header('Content-Type: ' . $r->content_type);
339
+            header('Content-Type: '.$r->content_type);
340 340
             // we do not know if client actually told us an accepted charset, but if it did we have to tell it what we did
341 341
             header("Vary: Accept-Charset");
342 342
 
@@ -359,10 +359,10 @@  discard block
 block discarded – undo
359 359
             // Note that Apache/mod_php will add (and even alter!) the Content-Length header on its own, but only for
360 360
             // responses up to 8000 bytes
361 361
             if ($phpNoSelfCompress) {
362
-                header('Content-Length: ' . (int)strlen($payload));
362
+                header('Content-Length: '.(int) strlen($payload));
363 363
             }
364 364
         } else {
365
-            $this->getLogger()->errorLog('XML-RPC: ' . __METHOD__ . ': http headers already sent before response is fully generated. Check for php warning or error messages');
365
+            $this->getLogger()->errorLog('XML-RPC: '.__METHOD__.': http headers already sent before response is fully generated. Check for php warning or error messages');
366 366
         }
367 367
 
368 368
         print $payload;
@@ -417,9 +417,9 @@  discard block
 block discarded – undo
417 417
             $numParams = count($in);
418 418
         }
419 419
         foreach ($sigs as $curSig) {
420
-            if (count($curSig) == $numParams + 1) {
420
+            if (count($curSig) == $numParams+1) {
421 421
                 $itsOK = 1;
422
-                for ($n = 0; $n < $numParams; $n++) {
422
+                for ($n = 0; $n<$numParams; $n++) {
423 423
                     if (is_object($in)) {
424 424
                         $p = $in->getParam($n);
425 425
                         if ($p->kindOf() == 'scalar') {
@@ -432,10 +432,10 @@  discard block
 block discarded – undo
432 432
                     }
433 433
 
434 434
                     // param index is $n+1, as first member of sig is return type
435
-                    if ($pt != $curSig[$n + 1] && $curSig[$n + 1] != Value::$xmlrpcValue) {
435
+                    if ($pt != $curSig[$n+1] && $curSig[$n+1] != Value::$xmlrpcValue) {
436 436
                         $itsOK = 0;
437
-                        $pno = $n + 1;
438
-                        $wanted = $curSig[$n + 1];
437
+                        $pno = $n+1;
438
+                        $wanted = $curSig[$n+1];
439 439
                         $got = $pt;
440 440
                         break;
441 441
                     }
@@ -462,10 +462,10 @@  discard block
 block discarded – undo
462 462
         // check if $_SERVER is populated: it might have been disabled via ini file
463 463
         // (this is true even when in CLI mode)
464 464
         if (count($_SERVER) == 0) {
465
-            $this->getLogger()->errorLog('XML-RPC: ' . __METHOD__ . ': cannot parse request headers as $_SERVER is not populated');
465
+            $this->getLogger()->errorLog('XML-RPC: '.__METHOD__.': cannot parse request headers as $_SERVER is not populated');
466 466
         }
467 467
 
468
-        if ($this->debug > 1) {
468
+        if ($this->debug>1) {
469 469
             if (function_exists('getallheaders')) {
470 470
                 $this->debugmsg(''); // empty line
471 471
                 foreach (getallheaders() as $name => $val) {
@@ -490,13 +490,13 @@  discard block
 block discarded – undo
490 490
                 if (function_exists('gzinflate') && in_array($contentEncoding, $this->accepted_compression)) {
491 491
                     if ($contentEncoding == 'deflate' && $degzdata = @gzuncompress($data)) {
492 492
                         $data = $degzdata;
493
-                        if ($this->debug > 1) {
494
-                            $this->debugmsg("\n+++INFLATED REQUEST+++[" . strlen($data) . " chars]+++\n" . $data . "\n+++END+++");
493
+                        if ($this->debug>1) {
494
+                            $this->debugmsg("\n+++INFLATED REQUEST+++[".strlen($data)." chars]+++\n".$data."\n+++END+++");
495 495
                         }
496 496
                     } elseif ($contentEncoding == 'gzip' && $degzdata = @gzinflate(substr($data, 10))) {
497 497
                         $data = $degzdata;
498
-                        if ($this->debug > 1) {
499
-                            $this->debugmsg("+++INFLATED REQUEST+++[" . strlen($data) . " chars]+++\n" . $data . "\n+++END+++");
498
+                        if ($this->debug>1) {
499
+                            $this->debugmsg("+++INFLATED REQUEST+++[".strlen($data)." chars]+++\n".$data."\n+++END+++");
500 500
                         }
501 501
                     } else {
502 502
                         $r = new Response(0, PhpXmlRpc::$xmlrpcerr['server_decompress_fail'],
@@ -589,7 +589,7 @@  discard block
 block discarded – undo
589 589
                     if ($reqEncoding == 'ISO-8859-1') {
590 590
                         $data = utf8_encode($data);
591 591
                     } else {
592
-                        $this->getLogger()->errorLog('XML-RPC: ' . __METHOD__ . ': invalid charset encoding of received request: ' . $reqEncoding);
592
+                        $this->getLogger()->errorLog('XML-RPC: '.__METHOD__.': invalid charset encoding of received request: '.$reqEncoding);
593 593
                     }
594 594
                 }
595 595
             }
@@ -608,18 +608,18 @@  discard block
 block discarded – undo
608 608
 
609 609
         $xmlRpcParser = $this->getParser();
610 610
         $xmlRpcParser->parse($data, $this->functions_parameters_type, XMLParser::ACCEPT_REQUEST, $options);
611
-        if ($xmlRpcParser->_xh['isf'] > 2) {
611
+        if ($xmlRpcParser->_xh['isf']>2) {
612 612
             // (BC) we return XML error as a faultCode
613 613
             preg_match('/^XML error ([0-9]+)/', $xmlRpcParser->_xh['isf_reason'], $matches);
614 614
             $r = new Response(
615 615
                 0,
616
-                PhpXmlRpc::$xmlrpcerrxml + (int)$matches[1],
616
+                PhpXmlRpc::$xmlrpcerrxml+(int) $matches[1],
617 617
                 $xmlRpcParser->_xh['isf_reason']);
618 618
         } elseif ($xmlRpcParser->_xh['isf']) {
619 619
             $r = new Response(
620 620
                 0,
621 621
                 PhpXmlRpc::$xmlrpcerr['invalid_request'],
622
-                PhpXmlRpc::$xmlrpcstr['invalid_request'] . ' ' . $xmlRpcParser->_xh['isf_reason']);
622
+                PhpXmlRpc::$xmlrpcstr['invalid_request'].' '.$xmlRpcParser->_xh['isf_reason']);
623 623
         } else {
624 624
             // small layering violation in favor of speed and memory usage:
625 625
             // we should allow the 'execute' method handle this, but in the
@@ -631,20 +631,20 @@  discard block
 block discarded – undo
631 631
                     ($this->dmap[$xmlRpcParser->_xh['method']]['parameters_type'] != 'xmlrpcvals')
632 632
                 )
633 633
             ) {
634
-                if ($this->debug > 1) {
635
-                    $this->debugmsg("\n+++PARSED+++\n" . var_export($xmlRpcParser->_xh['params'], true) . "\n+++END+++");
634
+                if ($this->debug>1) {
635
+                    $this->debugmsg("\n+++PARSED+++\n".var_export($xmlRpcParser->_xh['params'], true)."\n+++END+++");
636 636
                 }
637 637
                 $r = $this->execute($xmlRpcParser->_xh['method'], $xmlRpcParser->_xh['params'], $xmlRpcParser->_xh['pt']);
638 638
             } else {
639 639
                 // build a Request object with data parsed from xml
640 640
                 $req = new Request($xmlRpcParser->_xh['method']);
641 641
                 // now add parameters in
642
-                for ($i = 0; $i < count($xmlRpcParser->_xh['params']); $i++) {
642
+                for ($i = 0; $i<count($xmlRpcParser->_xh['params']); $i++) {
643 643
                     $req->addParam($xmlRpcParser->_xh['params'][$i]);
644 644
                 }
645 645
 
646
-                if ($this->debug > 1) {
647
-                    $this->debugmsg("\n+++PARSED+++\n" . var_export($req, true) . "\n+++END+++");
646
+                if ($this->debug>1) {
647
+                    $this->debugmsg("\n+++PARSED+++\n".var_export($req, true)."\n+++END+++");
648 648
                 }
649 649
                 $r = $this->execute($req);
650 650
             }
@@ -696,7 +696,7 @@  discard block
 block discarded – undo
696 696
                 return new Response(
697 697
                     0,
698 698
                     PhpXmlRpc::$xmlrpcerr['incorrect_params'],
699
-                    PhpXmlRpc::$xmlrpcstr['incorrect_params'] . ": {$errStr}"
699
+                    PhpXmlRpc::$xmlrpcstr['incorrect_params'].": {$errStr}"
700 700
                 );
701 701
             }
702 702
         }
@@ -709,7 +709,7 @@  discard block
 block discarded – undo
709 709
 
710 710
         if (is_array($func)) {
711 711
             if (is_object($func[0])) {
712
-                $funcName = get_class($func[0]) . '->' . $func[1];
712
+                $funcName = get_class($func[0]).'->'.$func[1];
713 713
             } else {
714 714
                 $funcName = implode('::', $func);
715 715
             }
@@ -721,17 +721,17 @@  discard block
 block discarded – undo
721 721
 
722 722
         // verify that function to be invoked is in fact callable
723 723
         if (!is_callable($func)) {
724
-            $this->getLogger()->errorLog("XML-RPC: " . __METHOD__ . ": function '$funcName' registered as method handler is not callable");
724
+            $this->getLogger()->errorLog("XML-RPC: ".__METHOD__.": function '$funcName' registered as method handler is not callable");
725 725
             return new Response(
726 726
                 0,
727 727
                 PhpXmlRpc::$xmlrpcerr['server_error'],
728
-                PhpXmlRpc::$xmlrpcstr['server_error'] . ": no function matches method"
728
+                PhpXmlRpc::$xmlrpcstr['server_error'].": no function matches method"
729 729
             );
730 730
         }
731 731
 
732 732
         // If debug level is 3, we should catch all errors generated during
733 733
         // processing of user function, and log them as part of response
734
-        if ($this->debug > 2) {
734
+        if ($this->debug>2) {
735 735
             self::$_xmlrpcs_prev_ehandler = set_error_handler(array('\PhpXmlRpc\Server', '_xmlrpcs_errorHandler'));
736 736
         }
737 737
 
@@ -744,14 +744,14 @@  discard block
 block discarded – undo
744 744
                     $r = call_user_func($func, $req);
745 745
                 }
746 746
                 if (!is_a($r, 'PhpXmlRpc\Response')) {
747
-                    $this->getLogger()->errorLog("XML-RPC: " . __METHOD__ . ": function '$funcName' registered as method handler does not return an xmlrpc response object but a " . gettype($r));
747
+                    $this->getLogger()->errorLog("XML-RPC: ".__METHOD__.": function '$funcName' registered as method handler does not return an xmlrpc response object but a ".gettype($r));
748 748
                     if (is_a($r, 'PhpXmlRpc\Value')) {
749 749
                         $r = new Response($r);
750 750
                     } else {
751 751
                         $r = new Response(
752 752
                             0,
753 753
                             PhpXmlRpc::$xmlrpcerr['server_error'],
754
-                            PhpXmlRpc::$xmlrpcstr['server_error'] . ": function does not return xmlrpc response object"
754
+                            PhpXmlRpc::$xmlrpcstr['server_error'].": function does not return xmlrpc response object"
755 755
                         );
756 756
                     }
757 757
                 }
@@ -767,7 +767,7 @@  discard block
 block discarded – undo
767 767
                         // mimic EPI behaviour: if we get an array that looks like an error, make it
768 768
                         // an error response
769 769
                         if (is_array($r) && array_key_exists('faultCode', $r) && array_key_exists('faultString', $r)) {
770
-                            $r = new Response(0, (integer)$r['faultCode'], (string)$r['faultString']);
770
+                            $r = new Response(0, (integer) $r['faultCode'], (string) $r['faultString']);
771 771
                         } else {
772 772
                             // functions using EPI api should NOT return resp objects,
773 773
                             // so make sure we encode the return type correctly
@@ -790,7 +790,7 @@  discard block
 block discarded – undo
790 790
             // proper error-response
791 791
             switch ($this->exception_handling) {
792 792
                 case 2:
793
-                    if ($this->debug > 2) {
793
+                    if ($this->debug>2) {
794 794
                         if (self::$_xmlrpcs_prev_ehandler) {
795 795
                             set_error_handler(self::$_xmlrpcs_prev_ehandler);
796 796
                         } else {
@@ -813,7 +813,7 @@  discard block
 block discarded – undo
813 813
             // proper error-response
814 814
             switch ($this->exception_handling) {
815 815
                 case 2:
816
-                    if ($this->debug > 2) {
816
+                    if ($this->debug>2) {
817 817
                         if (self::$_xmlrpcs_prev_ehandler) {
818 818
                             set_error_handler(self::$_xmlrpcs_prev_ehandler);
819 819
                         } else {
@@ -832,7 +832,7 @@  discard block
 block discarded – undo
832 832
                     $r = new Response(0, PhpXmlRpc::$xmlrpcerr['server_error'], PhpXmlRpc::$xmlrpcstr['server_error']);
833 833
             }
834 834
         }
835
-        if ($this->debug > 2) {
835
+        if ($this->debug>2) {
836 836
             // note: restore the error handler we found before calling the
837 837
             // user func, even if it has been changed inside the func itself
838 838
             if (self::$_xmlrpcs_prev_ehandler) {
@@ -853,7 +853,7 @@  discard block
 block discarded – undo
853 853
      */
854 854
     protected function debugmsg($string)
855 855
     {
856
-        $this->debug_info .= $string . "\n";
856
+        $this->debug_info .= $string."\n";
857 857
     }
858 858
 
859 859
     /**
@@ -863,9 +863,9 @@  discard block
 block discarded – undo
863 863
     protected function xml_header($charsetEncoding = '')
864 864
     {
865 865
         if ($charsetEncoding != '') {
866
-            return "<?xml version=\"1.0\" encoding=\"$charsetEncoding\"?" . ">\n";
866
+            return "<?xml version=\"1.0\" encoding=\"$charsetEncoding\"?".">\n";
867 867
         } else {
868
-            return "<?xml version=\"1.0\"?" . ">\n";
868
+            return "<?xml version=\"1.0\"?".">\n";
869 869
         }
870 870
     }
871 871
 
@@ -1136,7 +1136,7 @@  discard block
 block discarded – undo
1136 1136
                 $i++; // for error message, we count params from 1
1137 1137
                 return static::_xmlrpcs_multicall_error(new Response(0,
1138 1138
                     PhpXmlRpc::$xmlrpcerr['incorrect_params'],
1139
-                    PhpXmlRpc::$xmlrpcstr['incorrect_params'] . ": probable xml error in param " . $i));
1139
+                    PhpXmlRpc::$xmlrpcstr['incorrect_params'].": probable xml error in param ".$i));
1140 1140
             }
1141 1141
         }
1142 1142
 
@@ -1217,7 +1217,7 @@  discard block
 block discarded – undo
1217 1217
             }
1218 1218
         } else {
1219 1219
             $numCalls = count($req);
1220
-            for ($i = 0; $i < $numCalls; $i++) {
1220
+            for ($i = 0; $i<$numCalls; $i++) {
1221 1221
                 $result[$i] = static::_xmlrpcs_multicall_do_call_phpvals($server, $req[$i]);
1222 1222
             }
1223 1223
         }
Please login to merge, or discard this patch.
demo/server/methodProviders/functions.php 1 patch
Spacing   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -53,11 +53,11 @@  discard block
 block discarded – undo
53 53
         $snv = $sno->scalarval();
54 54
 
55 55
         // look it up in our array (zero-based)
56
-        if (isset(self::$stateNames[$snv - 1])) {
57
-            $stateName = self::$stateNames[$snv - 1];
56
+        if (isset(self::$stateNames[$snv-1])) {
57
+            $stateName = self::$stateNames[$snv-1];
58 58
         } else {
59 59
             // not there, so complain
60
-            $err = "I don't have a state for the index '" . $snv . "'";
60
+            $err = "I don't have a state for the index '".$snv."'";
61 61
         }
62 62
 
63 63
         if ($err != '') {
@@ -131,7 +131,7 @@  discard block
 block discarded – undo
131 131
         $s = $req->getParam(0);
132 132
         $t = $req->getParam(1);
133 133
 
134
-        return new Response(new Value($s->scalarval() + $t->scalarval(), Value::$xmlrpcInt));
134
+        return new Response(new Value($s->scalarval()+$t->scalarval(), Value::$xmlrpcInt));
135 135
     }
136 136
 
137 137
     public static $addtwodouble_sig = array(array('double', 'double', 'double'));
@@ -141,7 +141,7 @@  discard block
 block discarded – undo
141 141
         $s = $req->getParam(0);
142 142
         $t = $req->getParam(1);
143 143
 
144
-        return new Response(new Value($s->scalarval() + $t->scalarval(), Value::$xmlrpcDouble));
144
+        return new Response(new Value($s->scalarval()+$t->scalarval(), Value::$xmlrpcDouble));
145 145
     }
146 146
 
147 147
     public static $stringecho_sig = array(array('string', 'string'));
@@ -157,7 +157,7 @@  discard block
 block discarded – undo
157 157
     function echoBack($req)
158 158
     {
159 159
         // just sends back a string with what I got sent to me, that's all (escaping for xml is automatic)
160
-        $s = "I got the following message:\n" . $req->serialize();
160
+        $s = "I got the following message:\n".$req->serialize();
161 161
 
162 162
         return new Response(new Value($s));
163 163
     }
@@ -230,17 +230,17 @@  discard block
 block discarded – undo
230 230
 
231 231
         /// @todo in real life, we should check for presence of return characters to avoid header injection!
232 232
 
233
-        $msgHdr = "From: " . $mFrom->scalarval() . "\n";
234
-        $msgHdr .= "To: " . $mTo->scalarval() . "\n";
233
+        $msgHdr = "From: ".$mFrom->scalarval()."\n";
234
+        $msgHdr .= "To: ".$mTo->scalarval()."\n";
235 235
 
236 236
         if ($mCc->scalarval() != "") {
237
-            $msgHdr .= "Cc: " . $mCc->scalarval() . "\n";
237
+            $msgHdr .= "Cc: ".$mCc->scalarval()."\n";
238 238
         }
239 239
         if ($mBcc->scalarval() != "") {
240
-            $msgHdr .= "Bcc: " . $mBcc->scalarval() . "\n";
240
+            $msgHdr .= "Bcc: ".$mBcc->scalarval()."\n";
241 241
         }
242 242
         if ($mMime->scalarval() != "") {
243
-            $msgHdr .= "Content-type: " . $mMime->scalarval() . "\n";
243
+            $msgHdr .= "Content-type: ".$mMime->scalarval()."\n";
244 244
         }
245 245
         $msgHdr .= "X-Mailer: XML-RPC for PHP mailer 1.0";
246 246
 
Please login to merge, or discard this patch.