Passed
Push — master ( 8cdf44...424db6 )
by Gaetano
08:49
created
demo/server/server.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -21,7 +21,7 @@  discard block
 block discarded – undo
21 21
     die();
22 22
 }
23 23
 
24
-require_once __DIR__ . "/_prepend.php";
24
+require_once __DIR__."/_prepend.php";
25 25
 
26 26
 use PhpXmlRpc\PhpXmlRpc;
27 27
 use PhpXmlRpc\Server;
@@ -80,7 +80,7 @@  discard block
 block discarded – undo
80 80
         } elseif ($_GET['FORCE_AUTH'] == 'Digest') {
81 81
             if (empty($_SERVER['PHP_AUTH_DIGEST'])) {
82 82
                 header('HTTP/1.1 401 Unauthorized');
83
-                header('WWW-Authenticate: Digest realm="Phpxmlrpc Digest Realm",qop="auth",nonce="' . uniqid() . '",opaque="' . md5('Phpxmlrpc Digest Realm') . '"');
83
+                header('WWW-Authenticate: Digest realm="Phpxmlrpc Digest Realm",qop="auth",nonce="'.uniqid().'",opaque="'.md5('Phpxmlrpc Digest Realm').'"');
84 84
                 die('Text visible if user hits Cancel button');
85 85
             }
86 86
         }
Please login to merge, or discard this patch.
demo/server/_prepend.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -8,5 +8,5 @@
 block discarded – undo
8 8
 }
9 9
 
10 10
 // Use the custom class autoloader. These two lines are not needed when the phpxmlrpc library is installed using Composer
11
-include_once __DIR__ . '/../../src/Autoloader.php';
11
+include_once __DIR__.'/../../src/Autoloader.php';
12 12
 PhpXmlRpc\Autoloader::register();
Please login to merge, or discard this patch.
demo/client/_prepend.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -8,7 +8,7 @@
 block discarded – undo
8 8
 }
9 9
 
10 10
 // Use the custom class autoloader. These two lines are not needed when the phpxmlrpc library is installed using Composer
11
-include_once __DIR__ . '/../../src/Autoloader.php';
11
+include_once __DIR__.'/../../src/Autoloader.php';
12 12
 PhpXmlRpc\Autoloader::register();
13 13
 
14 14
 // Let unit tests run against localhost, 'plain' demos against a known public server
Please login to merge, or discard this patch.
src/Helper/Http.php 1 patch
Spacing   +24 added lines, -24 removed lines patch added patch discarded remove patch
@@ -46,12 +46,12 @@  discard block
 block discarded – undo
46 46
 
47 47
         // read chunk-size, chunk-extension (if any) and crlf
48 48
         // get the position of the linebreak
49
-        $chunkEnd = strpos($buffer, "\r\n") + 2;
49
+        $chunkEnd = strpos($buffer, "\r\n")+2;
50 50
         $temp = substr($buffer, 0, $chunkEnd);
51 51
         $chunkSize = hexdec(trim($temp));
52 52
         $chunkStart = $chunkEnd;
53
-        while ($chunkSize > 0) {
54
-            $chunkEnd = strpos($buffer, "\r\n", $chunkStart + $chunkSize);
53
+        while ($chunkSize>0) {
54
+            $chunkEnd = strpos($buffer, "\r\n", $chunkStart+$chunkSize);
55 55
 
56 56
             // just in case we got a broken connection
57 57
             if ($chunkEnd == false) {
@@ -63,19 +63,19 @@  discard block
 block discarded – undo
63 63
             }
64 64
 
65 65
             // read chunk-data and crlf
66
-            $chunk = substr($buffer, $chunkStart, $chunkEnd - $chunkStart);
66
+            $chunk = substr($buffer, $chunkStart, $chunkEnd-$chunkStart);
67 67
             // append chunk-data to entity-body
68 68
             $new .= $chunk;
69 69
             // length := length + chunk-size
70 70
             $length += strlen($chunk);
71 71
             // read chunk-size and crlf
72
-            $chunkStart = $chunkEnd + 2;
72
+            $chunkStart = $chunkEnd+2;
73 73
 
74
-            $chunkEnd = strpos($buffer, "\r\n", $chunkStart) + 2;
74
+            $chunkEnd = strpos($buffer, "\r\n", $chunkStart)+2;
75 75
             if ($chunkEnd == false) {
76 76
                 break; // just in case we got a broken connection
77 77
             }
78
-            $temp = substr($buffer, $chunkStart, $chunkEnd - $chunkStart);
78
+            $temp = substr($buffer, $chunkStart, $chunkEnd-$chunkStart);
79 79
             $chunkSize = hexdec(trim($temp));
80 80
             $chunkStart = $chunkEnd;
81 81
         }
@@ -104,11 +104,11 @@  discard block
 block discarded – undo
104 104
             // Look for CR/LF or simple LF as line separator (even though it is not valid http)
105 105
             $pos = strpos($data, "\r\n\r\n");
106 106
             if ($pos || is_int($pos)) {
107
-                $bd = $pos + 4;
107
+                $bd = $pos+4;
108 108
             } else {
109 109
                 $pos = strpos($data, "\n\n");
110 110
                 if ($pos || is_int($pos)) {
111
-                    $bd = $pos + 2;
111
+                    $bd = $pos+2;
112 112
                 } else {
113 113
                     // No separation between response headers and body: fault?
114 114
                     $bd = 0;
@@ -118,8 +118,8 @@  discard block
 block discarded – undo
118 118
                 // this filters out all http headers from proxy. maybe we could take them into account, too?
119 119
                 $data = substr($data, $bd);
120 120
             } else {
121
-                $this->getLogger()->errorLog('XML-RPC: ' . __METHOD__ . ': HTTPS via proxy error, tunnel connection possibly failed');
122
-                throw new HttpException(PhpXmlRpc::$xmlrpcstr['http_error'] . ' (HTTPS via proxy error, tunnel connection possibly failed)', PhpXmlRpc::$xmlrpcerr['http_error']);
121
+                $this->getLogger()->errorLog('XML-RPC: '.__METHOD__.': HTTPS via proxy error, tunnel connection possibly failed');
122
+                throw new HttpException(PhpXmlRpc::$xmlrpcstr['http_error'].' (HTTPS via proxy error, tunnel connection possibly failed)', PhpXmlRpc::$xmlrpcerr['http_error']);
123 123
             }
124 124
         }
125 125
 
@@ -152,19 +152,19 @@  discard block
 block discarded – undo
152 152
         }
153 153
 
154 154
         if ($httpResponse['status_code'] !== '200') {
155
-            $errstr = substr($data, 0, strpos($data, "\n") - 1);
156
-            $this->getLogger()->errorLog('XML-RPC: ' . __METHOD__ . ': HTTP error, got response: ' . $errstr);
157
-            throw new HttpException(PhpXmlRpc::$xmlrpcstr['http_error'] . ' (' . $errstr . ')', PhpXmlRpc::$xmlrpcerr['http_error'], null, $httpResponse['status_code']);
155
+            $errstr = substr($data, 0, strpos($data, "\n")-1);
156
+            $this->getLogger()->errorLog('XML-RPC: '.__METHOD__.': HTTP error, got response: '.$errstr);
157
+            throw new HttpException(PhpXmlRpc::$xmlrpcstr['http_error'].' ('.$errstr.')', PhpXmlRpc::$xmlrpcerr['http_error'], null, $httpResponse['status_code']);
158 158
         }
159 159
 
160 160
         // be tolerant to usage of \n instead of \r\n to separate headers and data (even though it is not valid http)
161 161
         $pos = strpos($data, "\r\n\r\n");
162 162
         if ($pos || is_int($pos)) {
163
-            $bd = $pos + 4;
163
+            $bd = $pos+4;
164 164
         } else {
165 165
             $pos = strpos($data, "\n\n");
166 166
             if ($pos || is_int($pos)) {
167
-                $bd = $pos + 2;
167
+                $bd = $pos+2;
168 168
             } else {
169 169
                 // No separation between response headers and body: fault?
170 170
                 // we could take some action here instead of going on...
@@ -178,7 +178,7 @@  discard block
 block discarded – undo
178 178
         foreach ($ar as $line) {
179 179
             // take care of multi-line headers and cookies
180 180
             $arr = explode(':', $line, 2);
181
-            if (count($arr) > 1) {
181
+            if (count($arr)>1) {
182 182
                 $headerName = strtolower(trim($arr[0]));
183 183
                 /// @todo some other headers (the ones that allow a CSV list of values) do allow many values to be
184 184
                 ///       passed using multiple header lines.
@@ -195,7 +195,7 @@  discard block
 block discarded – undo
195 195
                     foreach ($cookies as $cookie) {
196 196
                         // glue together all received cookies, using a comma to separate them (same as php does with getallheaders())
197 197
                         if (isset($httpResponse['headers'][$headerName])) {
198
-                            $httpResponse['headers'][$headerName] .= ', ' . trim($cookie);
198
+                            $httpResponse['headers'][$headerName] .= ', '.trim($cookie);
199 199
                         } else {
200 200
                             $httpResponse['headers'][$headerName] = trim($cookie);
201 201
                         }
@@ -224,7 +224,7 @@  discard block
 block discarded – undo
224 224
                 }
225 225
             } elseif (isset($headerName)) {
226 226
                 /// @todo version1 cookies might span multiple lines, thus breaking the parsing above
227
-                $httpResponse['headers'][$headerName] .= ' ' . trim($line);
227
+                $httpResponse['headers'][$headerName] .= ' '.trim($line);
228 228
             }
229 229
         }
230 230
 
@@ -247,7 +247,7 @@  discard block
 block discarded – undo
247 247
             // Decode chunked encoding sent by http 1.1 servers
248 248
             if (isset($httpResponse['headers']['transfer-encoding']) && $httpResponse['headers']['transfer-encoding'] == 'chunked') {
249 249
                 if (!$data = static::decodeChunked($data)) {
250
-                    $this->getLogger()->errorLog('XML-RPC: ' . __METHOD__ . ': errors occurred when trying to rebuild the chunked data received from server');
250
+                    $this->getLogger()->errorLog('XML-RPC: '.__METHOD__.': errors occurred when trying to rebuild the chunked data received from server');
251 251
                     throw new HttpException(PhpXmlRpc::$xmlrpcstr['dechunk_fail'], PhpXmlRpc::$xmlrpcerr['dechunk_fail'], null, $httpResponse['status_code']);
252 252
                 }
253 253
             }
@@ -262,19 +262,19 @@  discard block
 block discarded – undo
262 262
                         if ($httpResponse['headers']['content-encoding'] == 'deflate' && $degzdata = @gzuncompress($data)) {
263 263
                             $data = $degzdata;
264 264
                             if ($debug) {
265
-                                $this->getLogger()->debugMessage("---INFLATED RESPONSE---[" . strlen($data) . " chars]---\n$data\n---END---");
265
+                                $this->getLogger()->debugMessage("---INFLATED RESPONSE---[".strlen($data)." chars]---\n$data\n---END---");
266 266
                             }
267 267
                         } elseif ($httpResponse['headers']['content-encoding'] == 'gzip' && $degzdata = @gzinflate(substr($data, 10))) {
268 268
                             $data = $degzdata;
269 269
                             if ($debug) {
270
-                                $this->getLogger()->debugMessage("---INFLATED RESPONSE---[" . strlen($data) . " chars]---\n$data\n---END---");
270
+                                $this->getLogger()->debugMessage("---INFLATED RESPONSE---[".strlen($data)." chars]---\n$data\n---END---");
271 271
                             }
272 272
                         } else {
273
-                            $this->getLogger()->errorLog('XML-RPC: ' . __METHOD__ . ': errors occurred when trying to decode the deflated data received from server');
273
+                            $this->getLogger()->errorLog('XML-RPC: '.__METHOD__.': errors occurred when trying to decode the deflated data received from server');
274 274
                             throw new HttpException(PhpXmlRpc::$xmlrpcstr['decompress_fail'], PhpXmlRpc::$xmlrpcerr['decompress_fail'], null, $httpResponse['status_code']);
275 275
                         }
276 276
                     } else {
277
-                        $this->getLogger()->errorLog('XML-RPC: ' . __METHOD__ . ': the server sent deflated data. Your php install must have the Zlib extension compiled in to support this.');
277
+                        $this->getLogger()->errorLog('XML-RPC: '.__METHOD__.': the server sent deflated data. Your php install must have the Zlib extension compiled in to support this.');
278 278
                         throw new HttpException(PhpXmlRpc::$xmlrpcstr['cannot_decompress'], PhpXmlRpc::$xmlrpcerr['cannot_decompress'], null, $httpResponse['status_code']);
279 279
                     }
280 280
                 }
Please login to merge, or discard this patch.
src/Helper/XMLParser.php 1 patch
Spacing   +29 added lines, -29 removed lines patch added patch discarded remove patch
@@ -175,10 +175,10 @@  discard block
 block discarded – undo
175 175
         $this->accept = $accept;
176 176
 
177 177
         // @see ticket #70 - we have to parse big xml docks in chunks to avoid errors
178
-        for ($offset = 0; $offset < $len; $offset += $this->maxChunkLength) {
178
+        for ($offset = 0; $offset<$len; $offset += $this->maxChunkLength) {
179 179
             $chunk = substr($data, $offset, $this->maxChunkLength);
180 180
             // error handling: xml not well formed
181
-            if (!xml_parse($parser, $chunk, $offset + $this->maxChunkLength >= $len)) {
181
+            if (!xml_parse($parser, $chunk, $offset+$this->maxChunkLength>=$len)) {
182 182
                 $errCode = xml_get_error_code($parser);
183 183
                 $errStr = sprintf('XML error %s: %s at line %d, column %d', $errCode, xml_error_string($errCode),
184 184
                     xml_get_current_line_number($parser), xml_get_current_column_number($parser));
@@ -205,7 +205,7 @@  discard block
 block discarded – undo
205 205
     public function xmlrpc_se($parser, $name, $attrs, $acceptSingleVals = false)
206 206
     {
207 207
         // if invalid xmlrpc already detected, skip all processing
208
-        if ($this->_xh['isf'] < 2) {
208
+        if ($this->_xh['isf']<2) {
209 209
 
210 210
             // check for correct element nesting
211 211
             if (count($this->_xh['stack']) == 0) {
@@ -225,7 +225,7 @@  discard block
 block discarded – undo
225 225
                     $this->_xh['rt'] = strtolower($name);
226 226
                 } else {
227 227
                     $this->_xh['isf'] = 2;
228
-                    $this->_xh['isf_reason'] = 'missing top level xmlrpc element. Found: ' . $name;
228
+                    $this->_xh['isf_reason'] = 'missing top level xmlrpc element. Found: '.$name;
229 229
 
230 230
                     return;
231 231
                 }
@@ -319,7 +319,7 @@  discard block
 block discarded – undo
319 319
                     break;
320 320
                 case 'MEMBER':
321 321
                     // set member name to null, in case we do not find in the xml later on
322
-                    $this->_xh['valuestack'][count($this->_xh['valuestack']) - 1]['name'] = '';
322
+                    $this->_xh['valuestack'][count($this->_xh['valuestack'])-1]['name'] = '';
323 323
                     //$this->_xh['ac']='';
324 324
                 // Drop trough intentionally
325 325
                 case 'PARAM':
@@ -383,7 +383,7 @@  discard block
 block discarded – undo
383 383
      */
384 384
     public function xmlrpc_ee($parser, $name, $rebuildXmlrpcvals = 1)
385 385
     {
386
-        if ($this->_xh['isf'] < 2) {
386
+        if ($this->_xh['isf']<2) {
387 387
             // push this element name from stack
388 388
             // NB: if XML validates, correct opening/closing is guaranteed and
389 389
             // we do not have to check for $name == $currElem.
@@ -398,7 +398,7 @@  discard block
 block discarded – undo
398 398
                         $this->_xh['vt'] = Value::$xmlrpcString;
399 399
                     }
400 400
 
401
-                    if ($rebuildXmlrpcvals > 0) {
401
+                    if ($rebuildXmlrpcvals>0) {
402 402
                         // build the xmlrpc val out of the data received, and substitute it
403 403
                         $temp = new Value($this->_xh['value'], $this->_xh['vt']);
404 404
                         // in case we got info about underlying php class, save it
@@ -407,15 +407,15 @@  discard block
 block discarded – undo
407 407
                             $temp->_php_class = $this->_xh['php_class'];
408 408
                         }
409 409
                         $this->_xh['value'] = $temp;
410
-                    } elseif ($rebuildXmlrpcvals < 0) {
410
+                    } elseif ($rebuildXmlrpcvals<0) {
411 411
                         if ($this->_xh['vt'] == Value::$xmlrpcDateTime) {
412
-                            $this->_xh['value'] = (object)array(
412
+                            $this->_xh['value'] = (object) array(
413 413
                                 'xmlrpc_type' => 'datetime',
414 414
                                 'scalar' => $this->_xh['value'],
415 415
                                 'timestamp' => \PhpXmlRpc\Helper\Date::iso8601Decode($this->_xh['value'])
416 416
                             );
417 417
                         } elseif ($this->_xh['vt'] == Value::$xmlrpcBase64) {
418
-                            $this->_xh['value'] = (object)array(
418
+                            $this->_xh['value'] = (object) array(
419 419
                                 'xmlrpc_type' => 'base64',
420 420
                                 'scalar' => $this->_xh['value']
421 421
                             );
@@ -431,8 +431,8 @@  discard block
 block discarded – undo
431 431
                     // check if we are inside an array or struct:
432 432
                     // if value just built is inside an array, let's move it into array on the stack
433 433
                     $vscount = count($this->_xh['valuestack']);
434
-                    if ($vscount && $this->_xh['valuestack'][$vscount - 1]['type'] == 'ARRAY') {
435
-                        $this->_xh['valuestack'][$vscount - 1]['values'][] = $this->_xh['value'];
434
+                    if ($vscount && $this->_xh['valuestack'][$vscount-1]['type'] == 'ARRAY') {
435
+                        $this->_xh['valuestack'][$vscount-1]['values'][] = $this->_xh['value'];
436 436
                     }
437 437
                     break;
438 438
                 case 'BOOLEAN':
@@ -451,7 +451,7 @@  discard block
 block discarded – undo
451 451
                         $this->_xh['value'] = $this->_xh['ac'];
452 452
                     } elseif ($name == 'DATETIME.ISO8601') {
453 453
                         if (!preg_match('/^[0-9]{8}T[0-9]{2}:[0-9]{2}:[0-9]{2}$/', $this->_xh['ac'])) {
454
-                            $this->getLogger()->errorLog('XML-RPC: ' . __METHOD__ . ': invalid value received in DATETIME: ' . $this->_xh['ac']);
454
+                            $this->getLogger()->errorLog('XML-RPC: '.__METHOD__.': invalid value received in DATETIME: '.$this->_xh['ac']);
455 455
                         }
456 456
                         $this->_xh['vt'] = Value::$xmlrpcDateTime;
457 457
                         $this->_xh['value'] = $this->_xh['ac'];
@@ -470,7 +470,7 @@  discard block
 block discarded – undo
470 470
                         } else {
471 471
                             // log if receiving something strange, even though we set the value to false anyway
472 472
                             if ($this->_xh['ac'] != '0' && strcasecmp($this->_xh['ac'], 'false') != 0) {
473
-                                $this->getLogger()->errorLog('XML-RPC: ' . __METHOD__ . ': invalid value received in BOOLEAN: ' . $this->_xh['ac']);
473
+                                $this->getLogger()->errorLog('XML-RPC: '.__METHOD__.': invalid value received in BOOLEAN: '.$this->_xh['ac']);
474 474
                             }
475 475
                             $this->_xh['value'] = false;
476 476
                         }
@@ -480,37 +480,37 @@  discard block
 block discarded – undo
480 480
                         // NOTE: regexp could be much stricter than this...
481 481
                         if (!preg_match('/^[+-eE0123456789 \t.]+$/', $this->_xh['ac'])) {
482 482
                             /// @todo: find a better way of throwing an error than this!
483
-                            $this->getLogger()->errorLog('XML-RPC: ' . __METHOD__ . ': non numeric value received in DOUBLE: ' . $this->_xh['ac']);
483
+                            $this->getLogger()->errorLog('XML-RPC: '.__METHOD__.': non numeric value received in DOUBLE: '.$this->_xh['ac']);
484 484
                             $this->_xh['value'] = 'ERROR_NON_NUMERIC_FOUND';
485 485
                         } else {
486 486
                             // it's ok, add it on
487
-                            $this->_xh['value'] = (double)$this->_xh['ac'];
487
+                            $this->_xh['value'] = (double) $this->_xh['ac'];
488 488
                         }
489 489
                     } else {
490 490
                         // we have an I4/I8/INT
491 491
                         // we must check that only 0123456789-<space> are characters here
492 492
                         if (!preg_match('/^[+-]?[0123456789 \t]+$/', $this->_xh['ac'])) {
493 493
                             /// @todo find a better way of throwing an error than this!
494
-                            $this->getLogger()->errorLog('XML-RPC: ' . __METHOD__ . ': non numeric value received in INT: ' . $this->_xh['ac']);
494
+                            $this->getLogger()->errorLog('XML-RPC: '.__METHOD__.': non numeric value received in INT: '.$this->_xh['ac']);
495 495
                             $this->_xh['value'] = 'ERROR_NON_NUMERIC_FOUND';
496 496
                         } else {
497 497
                             // it's ok, add it on
498
-                            $this->_xh['value'] = (int)$this->_xh['ac'];
498
+                            $this->_xh['value'] = (int) $this->_xh['ac'];
499 499
                         }
500 500
                     }
501 501
                     $this->_xh['lv'] = 3; // indicate we've found a value
502 502
                     break;
503 503
                 case 'NAME':
504
-                    $this->_xh['valuestack'][count($this->_xh['valuestack']) - 1]['name'] = $this->_xh['ac'];
504
+                    $this->_xh['valuestack'][count($this->_xh['valuestack'])-1]['name'] = $this->_xh['ac'];
505 505
                     break;
506 506
                 case 'MEMBER':
507 507
                     // add to array in the stack the last element built,
508 508
                     // unless no VALUE was found
509 509
                     if ($this->_xh['vt']) {
510 510
                         $vscount = count($this->_xh['valuestack']);
511
-                        $this->_xh['valuestack'][$vscount - 1]['values'][$this->_xh['valuestack'][$vscount - 1]['name']] = $this->_xh['value'];
511
+                        $this->_xh['valuestack'][$vscount-1]['values'][$this->_xh['valuestack'][$vscount-1]['name']] = $this->_xh['value'];
512 512
                     } else {
513
-                        $this->getLogger()->errorLog('XML-RPC: ' . __METHOD__ . ': missing VALUE inside STRUCT in received xml');
513
+                        $this->getLogger()->errorLog('XML-RPC: '.__METHOD__.': missing VALUE inside STRUCT in received xml');
514 514
                     }
515 515
                     break;
516 516
                 case 'DATA':
@@ -533,7 +533,7 @@  discard block
 block discarded – undo
533 533
                         $this->_xh['params'][] = $this->_xh['value'];
534 534
                         $this->_xh['pt'][] = $this->_xh['vt'];
535 535
                     } else {
536
-                        $this->getLogger()->errorLog('XML-RPC: ' . __METHOD__ . ': missing VALUE inside PARAM in received xml');
536
+                        $this->getLogger()->errorLog('XML-RPC: '.__METHOD__.': missing VALUE inside PARAM in received xml');
537 537
                     }
538 538
                     break;
539 539
                 case 'METHODNAME':
@@ -598,7 +598,7 @@  discard block
 block discarded – undo
598 598
     public function xmlrpc_cd($parser, $data)
599 599
     {
600 600
         // skip processing if xml fault already detected
601
-        if ($this->_xh['isf'] < 2) {
601
+        if ($this->_xh['isf']<2) {
602 602
             // "lookforvalue==3" means that we've found an entire value
603 603
             // and should discard any further character data
604 604
             if ($this->_xh['lv'] != 3) {
@@ -619,7 +619,7 @@  discard block
 block discarded – undo
619 619
     public function xmlrpc_dh($parser, $data)
620 620
     {
621 621
         // skip processing if xml fault already detected
622
-        if ($this->_xh['isf'] < 2) {
622
+        if ($this->_xh['isf']<2) {
623 623
             if (substr($data, 0, 1) == '&' && substr($data, -1, 1) == ';') {
624 624
                 $this->_xh['ac'] .= $data;
625 625
             }
@@ -693,8 +693,8 @@  discard block
 block discarded – undo
693 693
         // Details:
694 694
         // SPACE:         (#x20 | #x9 | #xD | #xA)+ === [ \x9\xD\xA]+
695 695
         // EQ:            SPACE?=SPACE? === [ \x9\xD\xA]*=[ \x9\xD\xA]*
696
-        if (preg_match('/^<\?xml\s+version\s*=\s*' . "((?:\"[a-zA-Z0-9_.:-]+\")|(?:'[a-zA-Z0-9_.:-]+'))" .
697
-            '\s+encoding\s*=\s*' . "((?:\"[A-Za-z][A-Za-z0-9._-]*\")|(?:'[A-Za-z][A-Za-z0-9._-]*'))/",
696
+        if (preg_match('/^<\?xml\s+version\s*=\s*'."((?:\"[a-zA-Z0-9_.:-]+\")|(?:'[a-zA-Z0-9_.:-]+'))".
697
+            '\s+encoding\s*=\s*'."((?:\"[A-Za-z][A-Za-z0-9._-]*\")|(?:'[A-Za-z][A-Za-z0-9._-]*'))/",
698 698
             $xmlChunk, $matches)) {
699 699
             return strtoupper(substr($matches[2], 1, -1));
700 700
         }
@@ -712,7 +712,7 @@  discard block
 block discarded – undo
712 712
             // NB: mb_detect likes to call it ascii, xml parser likes to call it US_ASCII...
713 713
             // IANA also likes better US-ASCII, so go with it
714 714
             if ($enc == 'ASCII') {
715
-                $enc = 'US-' . $enc;
715
+                $enc = 'US-'.$enc;
716 716
             }
717 717
 
718 718
             return $enc;
@@ -747,8 +747,8 @@  discard block
 block discarded – undo
747 747
         // Details:
748 748
         // SPACE:         (#x20 | #x9 | #xD | #xA)+ === [ \x9\xD\xA]+
749 749
         // EQ:            SPACE?=SPACE? === [ \x9\xD\xA]*=[ \x9\xD\xA]*
750
-        if (preg_match('/^<\?xml\s+version\s*=\s*' . "((?:\"[a-zA-Z0-9_.:-]+\")|(?:'[a-zA-Z0-9_.:-]+'))" .
751
-            '\s+encoding\s*=\s*' . "((?:\"[A-Za-z][A-Za-z0-9._-]*\")|(?:'[A-Za-z][A-Za-z0-9._-]*'))/",
750
+        if (preg_match('/^<\?xml\s+version\s*=\s*'."((?:\"[a-zA-Z0-9_.:-]+\")|(?:'[a-zA-Z0-9_.:-]+'))".
751
+            '\s+encoding\s*=\s*'."((?:\"[A-Za-z][A-Za-z0-9._-]*\")|(?:'[A-Za-z][A-Za-z0-9._-]*'))/",
752 752
             $xmlChunk, $matches)) {
753 753
             return true;
754 754
         }
Please login to merge, or discard this patch.