Completed
Push — master ( 17cd11...b7b153 )
by Gaetano
09:12 queued 03:28
created
src/Request.php 1 patch
Spacing   +17 added lines, -17 removed lines patch added patch discarded remove patch
@@ -38,9 +38,9 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
                 );
Please login to merge, or discard this patch.
src/Encoder.php 1 patch
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -76,7 +76,7 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 
Please login to merge, or discard this patch.
tests/1ParsingBugsTest.php 1 patch
Spacing   +19 added lines, -19 removed lines patch added patch discarded remove patch
@@ -2,10 +2,10 @@  discard block
 block discarded – undo
2 2
 /**
3 3
  * NB: do not let your IDE fool you. The correct encoding for this file is NOT UTF8.
4 4
  */
5
-include_once __DIR__ . '/../lib/xmlrpc.inc';
6
-include_once __DIR__ . '/../lib/xmlrpcs.inc';
5
+include_once __DIR__.'/../lib/xmlrpc.inc';
6
+include_once __DIR__.'/../lib/xmlrpcs.inc';
7 7
 
8
-include_once __DIR__ . '/parse_args.php';
8
+include_once __DIR__.'/parse_args.php';
9 9
 
10 10
 /**
11 11
  * Tests involving parsing of xml and handling of xmlrpc values
@@ -61,7 +61,7 @@  discard block
 block discarded – undo
61 61
 
62 62
     public function testUnicodeInMemberName()
63 63
     {
64
-        $str = "G" . chr(252) . "nter, El" . chr(232) . "ne";
64
+        $str = "G".chr(252)."nter, El".chr(232)."ne";
65 65
         $v = array($str => new xmlrpcval(1));
66 66
         $r = new xmlrpcresp(new xmlrpcval($v, 'struct'));
67 67
         $r = $r->serialize();
@@ -78,7 +78,7 @@  discard block
 block discarded – undo
78 78
 <!-- $Id -->
79 79
 <!-- found by G. giunta, covers what happens when lib receives
80 80
   UTF8 chars in response text and comments -->
81
-<!-- ' . chr(224) . chr(252) . chr(232) . '&#224;&#252;&#232; -->
81
+<!-- ' . chr(224).chr(252).chr(232).'&#224;&#252;&#232; -->
82 82
 <methodResponse>
83 83
 <fault>
84 84
 <value>
@@ -89,7 +89,7 @@  discard block
 block discarded – undo
89 89
 </member>
90 90
 <member>
91 91
 <name>faultString</name>
92
-<value><string>' . chr(224) . chr(252) . chr(232) . '&#224;&#252;&#232;</string></value>
92
+<value><string>' . chr(224).chr(252).chr(232).'&#224;&#252;&#232;</string></value>
93 93
 </member>
94 94
 </struct>
95 95
 </value>
@@ -98,7 +98,7 @@  discard block
 block discarded – undo
98 98
         $m = $this->newMsg('dummy');
99 99
         $r = $m->parseResponse($response);
100 100
         $v = $r->faultString();
101
-        $this->assertEquals(chr(224) . chr(252) . chr(232) . chr(224) . chr(252) . chr(232), $v);
101
+        $this->assertEquals(chr(224).chr(252).chr(232).chr(224).chr(252).chr(232), $v);
102 102
     }
103 103
 
104 104
     public function testValidNumbers()
@@ -159,7 +159,7 @@  discard block
 block discarded – undo
159 159
 
160 160
     public function testI8()
161 161
     {
162
-        if (PHP_INT_SIZE == 4 ) {
162
+        if (PHP_INT_SIZE == 4) {
163 163
             $this->markTestSkipped('did not find a locale which sets decimal separator to comma');
164 164
             return;
165 165
         }
@@ -482,11 +482,11 @@  discard block
 block discarded – undo
482 482
 
483 483
     public function testUTF8Response()
484 484
     {
485
-        $string = chr(224) . chr(252) . chr(232);
485
+        $string = chr(224).chr(252).chr(232);
486 486
 
487 487
         $s = $this->newMsg('dummy');
488
-        $f = "HTTP/1.1 200 OK\r\nContent-type: text/xml; charset=UTF-8\r\n\r\n" . '<?xml version="1.0"?><methodResponse><params><param><value><struct><member><name>userid</name><value>311127</value></member>
489
-<member><name>dateCreated</name><value><dateTime.iso8601>20011126T09:17:52</dateTime.iso8601></value></member><member><name>content</name><value>' . utf8_encode($string) . '</value></member><member><name>postid</name><value>7414222</value></member></struct></value></param></params></methodResponse>
488
+        $f = "HTTP/1.1 200 OK\r\nContent-type: text/xml; charset=UTF-8\r\n\r\n".'<?xml version="1.0"?><methodResponse><params><param><value><struct><member><name>userid</name><value>311127</value></member>
489
+<member><name>dateCreated</name><value><dateTime.iso8601>20011126T09:17:52</dateTime.iso8601></value></member><member><name>content</name><value>' . utf8_encode($string).'</value></member><member><name>postid</name><value>7414222</value></member></struct></value></param></params></methodResponse>
490 490
 ';
491 491
         $r = $s->parseResponse($f, false, 'phpvals');
492 492
         $v = $r->value();
@@ -494,7 +494,7 @@  discard block
 block discarded – undo
494 494
         $this->assertEquals($string, $v);
495 495
 
496 496
         $f = '<?xml version="1.0" encoding="UTF-8"?><methodResponse><params><param><value><struct><member><name>userid</name><value>311127</value></member>
497
-<member><name>dateCreated</name><value><dateTime.iso8601>20011126T09:17:52</dateTime.iso8601></value></member><member><name>content</name><value>' . utf8_encode($string) . '</value></member><member><name>postid</name><value>7414222</value></member></struct></value></param></params></methodResponse>
497
+<member><name>dateCreated</name><value><dateTime.iso8601>20011126T09:17:52</dateTime.iso8601></value></member><member><name>content</name><value>' . utf8_encode($string).'</value></member><member><name>postid</name><value>7414222</value></member></struct></value></param></params></methodResponse>
498 498
 ';
499 499
         $r = $s->parseResponse($f, false, 'phpvals');
500 500
         $v = $r->value();
@@ -509,11 +509,11 @@  discard block
 block discarded – undo
509 509
 
510 510
     public function testLatin1Response()
511 511
     {
512
-        $string = chr(224) . chr(252) . chr(232);
512
+        $string = chr(224).chr(252).chr(232);
513 513
 
514 514
         $s = $this->newMsg('dummy');
515
-        $f = "HTTP/1.1 200 OK\r\nContent-type: text/xml; charset=ISO-8859-1\r\n\r\n" . '<?xml version="1.0"?><methodResponse><params><param><value><struct><member><name>userid</name><value>311127</value></member>
516
-<member><name>dateCreated</name><value><dateTime.iso8601>20011126T09:17:52</dateTime.iso8601></value></member><member><name>content</name><value>' . $string . '</value></member><member><name>postid</name><value>7414222</value></member></struct></value></param></params></methodResponse>
515
+        $f = "HTTP/1.1 200 OK\r\nContent-type: text/xml; charset=ISO-8859-1\r\n\r\n".'<?xml version="1.0"?><methodResponse><params><param><value><struct><member><name>userid</name><value>311127</value></member>
516
+<member><name>dateCreated</name><value><dateTime.iso8601>20011126T09:17:52</dateTime.iso8601></value></member><member><name>content</name><value>' . $string.'</value></member><member><name>postid</name><value>7414222</value></member></struct></value></param></params></methodResponse>
517 517
 ';
518 518
         $r = $s->parseResponse($f, false, 'phpvals');
519 519
         $v = $r->value();
@@ -521,7 +521,7 @@  discard block
 block discarded – undo
521 521
         $this->assertEquals($string, $v);
522 522
 
523 523
         $f = '<?xml version="1.0" encoding="ISO-8859-1"?><methodResponse><params><param><value><struct><member><name>userid</name><value>311127</value></member>
524
-<member><name>dateCreated</name><value><dateTime.iso8601>20011126T09:17:52</dateTime.iso8601></value></member><member><name>content</name><value>' . $string . '</value></member><member><name>postid</name><value>7414222</value></member></struct></value></param></params></methodResponse>
524
+<member><name>dateCreated</name><value><dateTime.iso8601>20011126T09:17:52</dateTime.iso8601></value></member><member><name>content</name><value>' . $string.'</value></member><member><name>postid</name><value>7414222</value></member></struct></value></param></params></methodResponse>
525 525
 ';
526 526
         $r = $s->parseResponse($f, false, 'phpvals');
527 527
         $v = $r->value();
@@ -616,7 +616,7 @@  discard block
 block discarded – undo
616 616
         $this->assertequals(1, count($v1));
617 617
         $out = array('me' => array(), 'mytype' => 2, '_php_class' => null);
618 618
 
619
-        foreach($v1 as $key => $val)
619
+        foreach ($v1 as $key => $val)
620 620
         {
621 621
             $this->assertArrayHasKey($key, $out);
622 622
             $expected = $out[$key];
@@ -631,7 +631,7 @@  discard block
 block discarded – undo
631 631
         $this->assertequals(2, count($v2));
632 632
         $out = array(array('key' => 0, 'value'  => 'object'), array('key' => 1, 'value'  => 'object'));
633 633
         $i = 0;
634
-        foreach($v2 as $key => $val)
634
+        foreach ($v2 as $key => $val)
635 635
         {
636 636
             $expected = $out[$i];
637 637
             $this->assertequals($expected['key'], $key);
@@ -644,7 +644,7 @@  discard block
 block discarded – undo
644 644
     {
645 645
         // nb: make sure that  the serialized xml corresponding to this is > 10MB in size
646 646
         $data = array();
647
-        for ($i = 0; $i < 500000; $i++ ) {
647
+        for ($i = 0; $i<500000; $i++) {
648 648
             $data[] = 'hello world';
649 649
         }
650 650
 
Please login to merge, or discard this patch.
src/Helper/XMLParser.php 1 patch
Spacing   +27 added lines, -27 removed lines patch added patch discarded remove patch
@@ -133,10 +133,10 @@  discard block
 block discarded – undo
133 133
         $this->accept = $accept;
134 134
 
135 135
         // @see ticket #70 - we have to parse big xml docks in chunks to avoid errors
136
-        for ($offset = 0; $offset < $len; $offset += $this->maxChunkLength) {
136
+        for ($offset = 0; $offset<$len; $offset += $this->maxChunkLength) {
137 137
             $chunk = substr($data, $offset, $this->maxChunkLength);
138 138
             // error handling: xml not well formed
139
-            if (!xml_parse($parser, $chunk, $offset + $this->maxChunkLength >= $len)) {
139
+            if (!xml_parse($parser, $chunk, $offset+$this->maxChunkLength>=$len)) {
140 140
                 $errCode = xml_get_error_code($parser);
141 141
                 $errStr = sprintf('XML error %s: %s at line %d, column %d', $errCode, xml_error_string($errCode),
142 142
                     xml_get_current_line_number($parser), xml_get_current_column_number($parser));
@@ -160,7 +160,7 @@  discard block
 block discarded – undo
160 160
     public function xmlrpc_se($parser, $name, $attrs, $acceptSingleVals = false)
161 161
     {
162 162
         // if invalid xmlrpc already detected, skip all processing
163
-        if ($this->_xh['isf'] < 2) {
163
+        if ($this->_xh['isf']<2) {
164 164
 
165 165
             // check for correct element nesting
166 166
             if (count($this->_xh['stack']) == 0) {
@@ -179,7 +179,7 @@  discard block
 block discarded – undo
179 179
                     $this->_xh['rt'] = strtolower($name);
180 180
                 } else {
181 181
                     $this->_xh['isf'] = 2;
182
-                    $this->_xh['isf_reason'] = 'missing top level xmlrpc element. Found: ' . $name;
182
+                    $this->_xh['isf_reason'] = 'missing top level xmlrpc element. Found: '.$name;
183 183
 
184 184
                     return;
185 185
                 }
@@ -273,7 +273,7 @@  discard block
 block discarded – undo
273 273
                     break;
274 274
                 case 'MEMBER':
275 275
                     // set member name to null, in case we do not find in the xml later on
276
-                    $this->_xh['valuestack'][count($this->_xh['valuestack']) - 1]['name'] = '';
276
+                    $this->_xh['valuestack'][count($this->_xh['valuestack'])-1]['name'] = '';
277 277
                     //$this->_xh['ac']='';
278 278
                 // Drop trough intentionally
279 279
                 case 'PARAM':
@@ -333,7 +333,7 @@  discard block
 block discarded – undo
333 333
      */
334 334
     public function xmlrpc_ee($parser, $name, $rebuildXmlrpcvals = true)
335 335
     {
336
-        if ($this->_xh['isf'] < 2) {
336
+        if ($this->_xh['isf']<2) {
337 337
             // push this element name from stack
338 338
             // NB: if XML validates, correct opening/closing is guaranteed and
339 339
             // we do not have to check for $name == $currElem.
@@ -359,8 +359,8 @@  discard block
 block discarded – undo
359 359
                         // check if we are inside an array or struct:
360 360
                         // if value just built is inside an array, let's move it into array on the stack
361 361
                         $vscount = count($this->_xh['valuestack']);
362
-                        if ($vscount && $this->_xh['valuestack'][$vscount - 1]['type'] == 'ARRAY') {
363
-                            $this->_xh['valuestack'][$vscount - 1]['values'][] = $temp;
362
+                        if ($vscount && $this->_xh['valuestack'][$vscount-1]['type'] == 'ARRAY') {
363
+                            $this->_xh['valuestack'][$vscount-1]['values'][] = $temp;
364 364
                         } else {
365 365
                             $this->_xh['value'] = $temp;
366 366
                         }
@@ -374,8 +374,8 @@  discard block
 block discarded – undo
374 374
                         // check if we are inside an array or struct:
375 375
                         // if value just built is inside an array, let's move it into array on the stack
376 376
                         $vscount = count($this->_xh['valuestack']);
377
-                        if ($vscount && $this->_xh['valuestack'][$vscount - 1]['type'] == 'ARRAY') {
378
-                            $this->_xh['valuestack'][$vscount - 1]['values'][] = $this->_xh['value'];
377
+                        if ($vscount && $this->_xh['valuestack'][$vscount-1]['type'] == 'ARRAY') {
378
+                            $this->_xh['valuestack'][$vscount-1]['values'][] = $this->_xh['value'];
379 379
                         }
380 380
                     }
381 381
                     break;
@@ -395,7 +395,7 @@  discard block
 block discarded – undo
395 395
                         $this->_xh['value'] = $this->_xh['ac'];
396 396
                     } elseif ($name == 'DATETIME.ISO8601') {
397 397
                         if (!preg_match('/^[0-9]{8}T[0-9]{2}:[0-9]{2}:[0-9]{2}$/', $this->_xh['ac'])) {
398
-                            error_log('XML-RPC: ' . __METHOD__ . ': invalid value received in DATETIME: ' . $this->_xh['ac']);
398
+                            error_log('XML-RPC: '.__METHOD__.': invalid value received in DATETIME: '.$this->_xh['ac']);
399 399
                         }
400 400
                         $this->_xh['vt'] = Value::$xmlrpcDateTime;
401 401
                         $this->_xh['value'] = $this->_xh['ac'];
@@ -414,7 +414,7 @@  discard block
 block discarded – undo
414 414
                         } else {
415 415
                             // log if receiving something strange, even though we set the value to false anyway
416 416
                             if ($this->_xh['ac'] != '0' && strcasecmp($this->_xh['ac'], 'false') != 0) {
417
-                                error_log('XML-RPC: ' . __METHOD__ . ': invalid value received in BOOLEAN: ' . $this->_xh['ac']);
417
+                                error_log('XML-RPC: '.__METHOD__.': invalid value received in BOOLEAN: '.$this->_xh['ac']);
418 418
                             }
419 419
                             $this->_xh['value'] = false;
420 420
                         }
@@ -424,37 +424,37 @@  discard block
 block discarded – undo
424 424
                         // NOTE: regexp could be much stricter than this...
425 425
                         if (!preg_match('/^[+-eE0123456789 \t.]+$/', $this->_xh['ac'])) {
426 426
                             /// @todo: find a better way of throwing an error than this!
427
-                            error_log('XML-RPC: ' . __METHOD__ . ': non numeric value received in DOUBLE: ' . $this->_xh['ac']);
427
+                            error_log('XML-RPC: '.__METHOD__.': non numeric value received in DOUBLE: '.$this->_xh['ac']);
428 428
                             $this->_xh['value'] = 'ERROR_NON_NUMERIC_FOUND';
429 429
                         } else {
430 430
                             // it's ok, add it on
431
-                            $this->_xh['value'] = (double)$this->_xh['ac'];
431
+                            $this->_xh['value'] = (double) $this->_xh['ac'];
432 432
                         }
433 433
                     } else {
434 434
                         // we have an I4/I8/INT
435 435
                         // we must check that only 0123456789-<space> are characters here
436 436
                         if (!preg_match('/^[+-]?[0123456789 \t]+$/', $this->_xh['ac'])) {
437 437
                             /// @todo find a better way of throwing an error than this!
438
-                            error_log('XML-RPC: ' . __METHOD__ . ': non numeric value received in INT: ' . $this->_xh['ac']);
438
+                            error_log('XML-RPC: '.__METHOD__.': non numeric value received in INT: '.$this->_xh['ac']);
439 439
                             $this->_xh['value'] = 'ERROR_NON_NUMERIC_FOUND';
440 440
                         } else {
441 441
                             // it's ok, add it on
442
-                            $this->_xh['value'] = (int)$this->_xh['ac'];
442
+                            $this->_xh['value'] = (int) $this->_xh['ac'];
443 443
                         }
444 444
                     }
445 445
                     $this->_xh['lv'] = 3; // indicate we've found a value
446 446
                     break;
447 447
                 case 'NAME':
448
-                    $this->_xh['valuestack'][count($this->_xh['valuestack']) - 1]['name'] = $this->_xh['ac'];
448
+                    $this->_xh['valuestack'][count($this->_xh['valuestack'])-1]['name'] = $this->_xh['ac'];
449 449
                     break;
450 450
                 case 'MEMBER':
451 451
                     // add to array in the stack the last element built,
452 452
                     // unless no VALUE was found
453 453
                     if ($this->_xh['vt']) {
454 454
                         $vscount = count($this->_xh['valuestack']);
455
-                        $this->_xh['valuestack'][$vscount - 1]['values'][$this->_xh['valuestack'][$vscount - 1]['name']] = $this->_xh['value'];
455
+                        $this->_xh['valuestack'][$vscount-1]['values'][$this->_xh['valuestack'][$vscount-1]['name']] = $this->_xh['value'];
456 456
                     } else {
457
-                        error_log('XML-RPC: ' . __METHOD__ . ': missing VALUE inside STRUCT in received xml');
457
+                        error_log('XML-RPC: '.__METHOD__.': missing VALUE inside STRUCT in received xml');
458 458
                     }
459 459
                     break;
460 460
                 case 'DATA':
@@ -477,7 +477,7 @@  discard block
 block discarded – undo
477 477
                         $this->_xh['params'][] = $this->_xh['value'];
478 478
                         $this->_xh['pt'][] = $this->_xh['vt'];
479 479
                     } else {
480
-                        error_log('XML-RPC: ' . __METHOD__ . ': missing VALUE inside PARAM in received xml');
480
+                        error_log('XML-RPC: '.__METHOD__.': missing VALUE inside PARAM in received xml');
481 481
                     }
482 482
                     break;
483 483
                 case 'METHODNAME':
@@ -523,7 +523,7 @@  discard block
 block discarded – undo
523 523
     public function xmlrpc_cd($parser, $data)
524 524
     {
525 525
         // skip processing if xml fault already detected
526
-        if ($this->_xh['isf'] < 2) {
526
+        if ($this->_xh['isf']<2) {
527 527
             // "lookforvalue==3" means that we've found an entire value
528 528
             // and should discard any further character data
529 529
             if ($this->_xh['lv'] != 3) {
@@ -541,7 +541,7 @@  discard block
 block discarded – undo
541 541
     public function xmlrpc_dh($parser, $data)
542 542
     {
543 543
         // skip processing if xml fault already detected
544
-        if ($this->_xh['isf'] < 2) {
544
+        if ($this->_xh['isf']<2) {
545 545
             if (substr($data, 0, 1) == '&' && substr($data, -1, 1) == ';') {
546 546
                 $this->_xh['ac'] .= $data;
547 547
             }
@@ -612,8 +612,8 @@  discard block
 block discarded – undo
612 612
         // Details:
613 613
         // SPACE:         (#x20 | #x9 | #xD | #xA)+ === [ \x9\xD\xA]+
614 614
         // EQ:            SPACE?=SPACE? === [ \x9\xD\xA]*=[ \x9\xD\xA]*
615
-        if (preg_match('/^<\?xml\s+version\s*=\s*' . "((?:\"[a-zA-Z0-9_.:-]+\")|(?:'[a-zA-Z0-9_.:-]+'))" .
616
-            '\s+encoding\s*=\s*' . "((?:\"[A-Za-z][A-Za-z0-9._-]*\")|(?:'[A-Za-z][A-Za-z0-9._-]*'))/",
615
+        if (preg_match('/^<\?xml\s+version\s*=\s*'."((?:\"[a-zA-Z0-9_.:-]+\")|(?:'[a-zA-Z0-9_.:-]+'))".
616
+            '\s+encoding\s*=\s*'."((?:\"[A-Za-z][A-Za-z0-9._-]*\")|(?:'[A-Za-z][A-Za-z0-9._-]*'))/",
617 617
             $xmlChunk, $matches)) {
618 618
             return strtoupper(substr($matches[2], 1, -1));
619 619
         }
@@ -631,7 +631,7 @@  discard block
 block discarded – undo
631 631
             // NB: mb_detect likes to call it ascii, xml parser likes to call it US_ASCII...
632 632
             // IANA also likes better US-ASCII, so go with it
633 633
             if ($enc == 'ASCII') {
634
-                $enc = 'US-' . $enc;
634
+                $enc = 'US-'.$enc;
635 635
             }
636 636
 
637 637
             return $enc;
@@ -666,8 +666,8 @@  discard block
 block discarded – undo
666 666
         // Details:
667 667
         // SPACE:         (#x20 | #x9 | #xD | #xA)+ === [ \x9\xD\xA]+
668 668
         // EQ:            SPACE?=SPACE? === [ \x9\xD\xA]*=[ \x9\xD\xA]*
669
-        if (preg_match('/^<\?xml\s+version\s*=\s*' . "((?:\"[a-zA-Z0-9_.:-]+\")|(?:'[a-zA-Z0-9_.:-]+'))" .
670
-            '\s+encoding\s*=\s*' . "((?:\"[A-Za-z][A-Za-z0-9._-]*\")|(?:'[A-Za-z][A-Za-z0-9._-]*'))/",
669
+        if (preg_match('/^<\?xml\s+version\s*=\s*'."((?:\"[a-zA-Z0-9_.:-]+\")|(?:'[a-zA-Z0-9_.:-]+'))".
670
+            '\s+encoding\s*=\s*'."((?:\"[A-Za-z][A-Za-z0-9._-]*\")|(?:'[A-Za-z][A-Za-z0-9._-]*'))/",
671 671
             $xmlChunk, $matches)) {
672 672
             return true;
673 673
         }
Please login to merge, or discard this patch.
src/Server.php 1 patch
Spacing   +52 added lines, -52 removed lines patch added patch discarded remove patch
@@ -152,7 +152,7 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
         }
Please login to merge, or discard this patch.