@@ -1,6 +1,6 @@ discard block |
||
1 | 1 | <?php |
2 | 2 | |
3 | -include_once __DIR__ . '/WebTestCase.php'; |
|
3 | +include_once __DIR__.'/WebTestCase.php'; |
|
4 | 4 | |
5 | 5 | /** |
6 | 6 | * Tests for php files in the 'demo' directory. |
@@ -12,8 +12,8 @@ discard block |
||
12 | 12 | $this->args = argParser::getArgs(); |
13 | 13 | |
14 | 14 | // assumes HTTPURI to be in the form /tests/index.php?etc... |
15 | - $this->baseUrl = $this->args['HTTPSERVER'] . preg_replace('|\?.+|', '', $this->args['HTTPURI']); |
|
16 | - $this->coverageScriptUrl = 'http://' . $this->args['HTTPSERVER'] . preg_replace('|/tests/index\.php(\?.*)?|', '/tests/phpunit_coverage.php', $this->args['HTTPURI']); |
|
15 | + $this->baseUrl = $this->args['HTTPSERVER'].preg_replace('|\?.+|', '', $this->args['HTTPURI']); |
|
16 | + $this->coverageScriptUrl = 'http://'.$this->args['HTTPSERVER'].preg_replace('|/tests/index\.php(\?.*)?|', '/tests/phpunit_coverage.php', $this->args['HTTPURI']); |
|
17 | 17 | } |
18 | 18 | |
19 | 19 | public function testVardemo() |
@@ -1,11 +1,11 @@ discard block |
||
1 | 1 | <?php |
2 | 2 | |
3 | -include_once __DIR__ . '/../lib/xmlrpc.inc'; |
|
4 | -include_once __DIR__ . '/../lib/xmlrpcs.inc'; |
|
3 | +include_once __DIR__.'/../lib/xmlrpc.inc'; |
|
4 | +include_once __DIR__.'/../lib/xmlrpcs.inc'; |
|
5 | 5 | |
6 | -include_once __DIR__ . '/parse_args.php'; |
|
6 | +include_once __DIR__.'/parse_args.php'; |
|
7 | 7 | |
8 | -include_once __DIR__ . '/PolyfillTestCase.php'; |
|
8 | +include_once __DIR__.'/PolyfillTestCase.php'; |
|
9 | 9 | |
10 | 10 | use PHPUnit\Runner\BaseTestRunner; |
11 | 11 | |
@@ -129,7 +129,7 @@ discard block |
||
129 | 129 | |
130 | 130 | public function testI8() |
131 | 131 | { |
132 | - if (PHP_INT_SIZE == 4 ) { |
|
132 | + if (PHP_INT_SIZE == 4) { |
|
133 | 133 | $this->markTestSkipped('Can not test i8 as php is compiled in 32 bit mode'); |
134 | 134 | return; |
135 | 135 | } |
@@ -204,7 +204,7 @@ discard block |
||
204 | 204 | |
205 | 205 | public function testUnicodeInMemberName() |
206 | 206 | { |
207 | - $str = "G" . chr(252) . "nter, El" . chr(232) . "ne"; |
|
207 | + $str = "G".chr(252)."nter, El".chr(232)."ne"; |
|
208 | 208 | $v = array($str => new xmlrpcval(1)); |
209 | 209 | $r = new xmlrpcresp(new xmlrpcval($v, 'struct')); |
210 | 210 | $r = $r->serialize(); |
@@ -220,7 +220,7 @@ discard block |
||
220 | 220 | $response = @utf8_encode( |
221 | 221 | '<?xml version="1.0"?> |
222 | 222 | <!-- covers what happens when lib receives UTF8 chars in response text and comments --> |
223 | -<!-- ' . chr(224) . chr(252) . chr(232) . 'àüè --> |
|
223 | +<!-- ' . chr(224).chr(252).chr(232).'àüè --> |
|
224 | 224 | <methodResponse> |
225 | 225 | <fault> |
226 | 226 | <value> |
@@ -231,7 +231,7 @@ discard block |
||
231 | 231 | </member> |
232 | 232 | <member> |
233 | 233 | <name>faultString</name> |
234 | -<value><string>' . chr(224) . chr(252) . chr(232) . 'àüè</string></value> |
|
234 | +<value><string>' . chr(224).chr(252).chr(232).'àüè</string></value> |
|
235 | 235 | </member> |
236 | 236 | </struct> |
237 | 237 | </value> |
@@ -240,7 +240,7 @@ discard block |
||
240 | 240 | $m = $this->newRequest('dummy'); |
241 | 241 | $r = $m->parseResponse($response); |
242 | 242 | $v = $r->faultString(); |
243 | - $this->assertEquals(chr(224) . chr(252) . chr(232) . chr(224) . chr(252) . chr(232), $v); |
|
243 | + $this->assertEquals(chr(224).chr(252).chr(232).chr(224).chr(252).chr(232), $v); |
|
244 | 244 | } |
245 | 245 | |
246 | 246 | public function testBrokenRequests() |
@@ -447,8 +447,8 @@ discard block |
||
447 | 447 | $i = \PhpXmlRpc\PhpXmlRpc::$xmlrpc_reject_invalid_values; |
448 | 448 | \PhpXmlRpc\PhpXmlRpc::$xmlrpc_reject_invalid_values = true; |
449 | 449 | |
450 | - foreach($values as $value) { |
|
451 | - $f = '<?xml version="1.0"?><methodResponse><params><param><value>' . $value . '</value></param></params></methodResponse> '; |
|
450 | + foreach ($values as $value) { |
|
451 | + $f = '<?xml version="1.0"?><methodResponse><params><param><value>'.$value.'</value></param></params></methodResponse> '; |
|
452 | 452 | $r = $s->parseResponse($f); |
453 | 453 | $v = $r->faultCode(); |
454 | 454 | $this->assertEquals(2, $v, "Testing $value"); |
@@ -552,11 +552,11 @@ discard block |
||
552 | 552 | |
553 | 553 | public function testUTF8Response() |
554 | 554 | { |
555 | - $string = chr(224) . chr(252) . chr(232); |
|
555 | + $string = chr(224).chr(252).chr(232); |
|
556 | 556 | |
557 | 557 | $s = $this->newRequest('dummy'); |
558 | - $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> |
|
559 | -<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> |
|
558 | + $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> |
|
559 | +<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> |
|
560 | 560 | '; |
561 | 561 | $r = $s->parseResponse($f, false, 'phpvals'); |
562 | 562 | $v = $r->value(); |
@@ -564,7 +564,7 @@ discard block |
||
564 | 564 | $this->assertEquals($string, $v); |
565 | 565 | |
566 | 566 | $f = '<?xml version="1.0" encoding="UTF-8"?><methodResponse><params><param><value><struct><member><name>userid</name><value>311127</value></member> |
567 | -<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> |
|
567 | +<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> |
|
568 | 568 | '; |
569 | 569 | $r = $s->parseResponse($f, false, 'phpvals'); |
570 | 570 | $v = $r->value(); |
@@ -580,11 +580,11 @@ discard block |
||
580 | 580 | |
581 | 581 | public function testLatin1Response() |
582 | 582 | { |
583 | - $string = chr(224) . chr(252) . chr(232); |
|
583 | + $string = chr(224).chr(252).chr(232); |
|
584 | 584 | |
585 | 585 | $s = $this->newRequest('dummy'); |
586 | - $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> |
|
587 | -<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> |
|
586 | + $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> |
|
587 | +<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> |
|
588 | 588 | '; |
589 | 589 | $r = $s->parseResponse($f, false, 'phpvals'); |
590 | 590 | $v = $r->value(); |
@@ -592,7 +592,7 @@ discard block |
||
592 | 592 | $this->assertEquals($string, $v); |
593 | 593 | |
594 | 594 | $f = '<?xml version="1.0" encoding="ISO-8859-1"?><methodResponse><params><param><value><struct><member><name>userid</name><value>311127</value></member> |
595 | -<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> |
|
595 | +<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> |
|
596 | 596 | '; |
597 | 597 | $r = $s->parseResponse($f, false, 'phpvals'); |
598 | 598 | $v = $r->value(); |
@@ -21,14 +21,16 @@ |
||
21 | 21 | protected function set_up() |
22 | 22 | { |
23 | 23 | $this->args = argParser::getArgs(); |
24 | - if ($this->args['DEBUG'] == 1) |
|
25 | - ob_start(); |
|
24 | + if ($this->args['DEBUG'] == 1) { |
|
25 | + ob_start(); |
|
26 | + } |
|
26 | 27 | } |
27 | 28 | |
28 | 29 | protected function tear_down() |
29 | 30 | { |
30 | - if ($this->args['DEBUG'] != 1) |
|
31 | - return; |
|
31 | + if ($this->args['DEBUG'] != 1) { |
|
32 | + return; |
|
33 | + } |
|
32 | 34 | $out = ob_get_clean(); |
33 | 35 | $status = $this->getStatus(); |
34 | 36 | if ($status == BaseTestRunner::STATUS_ERROR |
@@ -1,11 +1,11 @@ discard block |
||
1 | 1 | <?php |
2 | 2 | |
3 | -include_once __DIR__ . '/../lib/xmlrpc.inc'; |
|
4 | -include_once __DIR__ . '/../lib/xmlrpc_wrappers.inc'; |
|
3 | +include_once __DIR__.'/../lib/xmlrpc.inc'; |
|
4 | +include_once __DIR__.'/../lib/xmlrpc_wrappers.inc'; |
|
5 | 5 | |
6 | -include_once __DIR__ . '/parse_args.php'; |
|
6 | +include_once __DIR__.'/parse_args.php'; |
|
7 | 7 | |
8 | -include_once __DIR__ . '/08ServerTest.php'; |
|
8 | +include_once __DIR__.'/08ServerTest.php'; |
|
9 | 9 | |
10 | 10 | /** |
11 | 11 | * Tests which stress http features of the library. |
@@ -30,7 +30,7 @@ discard block |
||
30 | 30 | ); |
31 | 31 | |
32 | 32 | $methods = array(); |
33 | - foreach(get_class_methods('ServerTest') as $method) |
|
33 | + foreach (get_class_methods('ServerTest') as $method) |
|
34 | 34 | { |
35 | 35 | if (strpos($method, 'test') === 0 && !in_array($method, $unsafeMethods)) |
36 | 36 | { |
@@ -304,7 +304,7 @@ discard block |
||
304 | 304 | preg_match('/ubunutu([0-9]+)/', $output[0], $matches); |
305 | 305 | $ubuntuVersion = @$matches[1]; |
306 | 306 | } |
307 | - if ($ubuntuVersion >= 20) { |
|
307 | + if ($ubuntuVersion>=20) { |
|
308 | 308 | $this->markTestSkipped('HTTPS via Socket known to fail on php less than 7.2 on Ubuntu 20 and higher'); |
309 | 309 | return; |
310 | 310 | } |
@@ -201,8 +201,7 @@ discard block |
||
201 | 201 | { |
202 | 202 | $this->markTestSkipped('CURL missing: cannot test http 1.1 w. proxy'); |
203 | 203 | return; |
204 | - } |
|
205 | - else if ($this->args['PROXYSERVER'] == '') |
|
204 | + } else if ($this->args['PROXYSERVER'] == '') |
|
206 | 205 | { |
207 | 206 | $this->markTestSkipped('PROXYSERVER definition missing: cannot test proxy w. http 1.1'); |
208 | 207 | return; |
@@ -226,8 +225,7 @@ discard block |
||
226 | 225 | { |
227 | 226 | $this->markTestSkipped('CURL missing: cannot test https functionality'); |
228 | 227 | return; |
229 | - } |
|
230 | - else if ($this->args['HTTPSSERVER'] == '') |
|
228 | + } else if ($this->args['HTTPSSERVER'] == '') |
|
231 | 229 | { |
232 | 230 | $this->markTestSkipped('HTTPS SERVER definition missing: cannot test https'); |
233 | 231 | return; |
@@ -278,13 +276,11 @@ discard block |
||
278 | 276 | { |
279 | 277 | $this->markTestSkipped('CURL missing: cannot test https w. proxy'); |
280 | 278 | return; |
281 | - } |
|
282 | - else if ($this->args['PROXYSERVER'] == '') |
|
279 | + } else if ($this->args['PROXYSERVER'] == '') |
|
283 | 280 | { |
284 | 281 | $this->markTestSkipped('PROXYSERVER definition missing: cannot test proxy w. https'); |
285 | 282 | return; |
286 | - } |
|
287 | - else if ($this->args['HTTPSSERVER'] == '') |
|
283 | + } else if ($this->args['HTTPSSERVER'] == '') |
|
288 | 284 | { |
289 | 285 | $this->markTestSkipped('HTTPS SERVER definition missing: cannot test https w. proxy'); |
290 | 286 | return; |
@@ -1,5 +1,5 @@ discard block |
||
1 | 1 | <?php |
2 | -require_once __DIR__ . "/_prepend.php"; |
|
2 | +require_once __DIR__."/_prepend.php"; |
|
3 | 3 | |
4 | 4 | require_once __DIR__.'/methodProviders/CommentManager.php'; |
5 | 5 | |
@@ -25,33 +25,33 @@ discard block |
||
25 | 25 | // generate a file with a class definition |
26 | 26 | |
27 | 27 | // the generated code does not have an autoloader included - we need to add in one |
28 | -$autoloader = __DIR__ . "/_prepend.php"; |
|
28 | +$autoloader = __DIR__."/_prepend.php"; |
|
29 | 29 | |
30 | 30 | file_put_contents($targetClassFile, |
31 | - "<?php\n\n" . |
|
32 | - "require_once '$autoloader';\n\n" . |
|
31 | + "<?php\n\n". |
|
32 | + "require_once '$autoloader';\n\n". |
|
33 | 33 | "class MyServerClass\n{\n\n" |
34 | 34 | ) || die('uh oh'); |
35 | 35 | |
36 | 36 | // we mangle a bit the code we get from wrapPhpClass to generate a php class instead of a bunch of functions |
37 | 37 | |
38 | -foreach($code as $methodName => $methodDef) { |
|
39 | - file_put_contents($targetClassFile, ' ' . str_replace(array('function ', "\n"), array('public static function ', "\n "), $methodDef['source']) . "\n\n", FILE_APPEND) || die('uh oh'); |
|
40 | - $code[$methodName]['function'] = 'MyServerClass::' . $methodDef['function']; |
|
38 | +foreach ($code as $methodName => $methodDef) { |
|
39 | + file_put_contents($targetClassFile, ' '.str_replace(array('function ', "\n"), array('public static function ', "\n "), $methodDef['source'])."\n\n", FILE_APPEND) || die('uh oh'); |
|
40 | + $code[$methodName]['function'] = 'MyServerClass::'.$methodDef['function']; |
|
41 | 41 | unset($code[$methodName]['source']); |
42 | 42 | } |
43 | 43 | file_put_contents($targetClassFile, "}\n", FILE_APPEND) || die('uh oh'); |
44 | 44 | |
45 | 45 | // generate separate files with the xml-rpc server instantiation and its dispatch map |
46 | 46 | |
47 | -file_put_contents($targetDispatchMapFile, "<?php\n\nreturn " . var_export($code, true) . ";\n"); |
|
47 | +file_put_contents($targetDispatchMapFile, "<?php\n\nreturn ".var_export($code, true).";\n"); |
|
48 | 48 | |
49 | 49 | file_put_contents($targetControllerFile, |
50 | - "<?php\n\n" . |
|
50 | + "<?php\n\n". |
|
51 | 51 | |
52 | - "require_once '$autoloader';\n\n" . |
|
52 | + "require_once '$autoloader';\n\n". |
|
53 | 53 | |
54 | - "require_once '$targetClassFile';\n\n" . |
|
54 | + "require_once '$targetClassFile';\n\n". |
|
55 | 55 | |
56 | 56 | // NB: since we are running the generated code within the same script, the existing CommentManager instance will be |
57 | 57 | // available for usage by the methods of MyServerClass, as we keep a reference to them within the variable Wrapper::$objHolder |
@@ -61,12 +61,12 @@ discard block |
||
61 | 61 | // Wrapper::holdObject('xmlrpc_CommentManager_addComment', $cm); |
62 | 62 | // Wrapper::holdObject('xmlrpc_CommentManager_getComments', $cm); |
63 | 63 | |
64 | - "\$dm = require_once '$targetDispatchMapFile';\n" . |
|
65 | - '$s = new \PhpXmlRpc\Server($dm, false);' . "\n" . |
|
66 | - '// NB: do not leave these 2 debug lines enabled on publicly accessible servers!' . "\n" . |
|
67 | - '$s->setDebug(2);' . "\n" . |
|
68 | - '$s->exception_handling = 1;' . "\n" . |
|
69 | - '$s->service();' . "\n" |
|
64 | + "\$dm = require_once '$targetDispatchMapFile';\n". |
|
65 | + '$s = new \PhpXmlRpc\Server($dm, false);'."\n". |
|
66 | + '// NB: do not leave these 2 debug lines enabled on publicly accessible servers!'."\n". |
|
67 | + '$s->setDebug(2);'."\n". |
|
68 | + '$s->exception_handling = 1;'."\n". |
|
69 | + '$s->service();'."\n" |
|
70 | 70 | ) || die('uh oh'); |
71 | 71 | |
72 | 72 | // test that everything worked by running it in realtime (note that this will return an xml-rpc error message if run |
@@ -21,7 +21,7 @@ discard block |
||
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 |
||
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 | } |
@@ -88,7 +88,7 @@ discard block |
||
88 | 88 | if (isset($_GET['FORCE_REDIRECT'])) { |
89 | 89 | header('HTTP/1.0 302 Found'); |
90 | 90 | unset($_GET['FORCE_REDIRECT']); |
91 | - header('Location: ' . $_SERVER['REQUEST_URI'] . (count($_GET) ? '?' . http_build_query($_GET) : '')); |
|
91 | + header('Location: '.$_SERVER['REQUEST_URI'].(count($_GET) ? '?'.http_build_query($_GET) : '')); |
|
92 | 92 | die(); |
93 | 93 | } |
94 | 94 | } |
@@ -182,12 +182,12 @@ discard block |
||
182 | 182 | foreach ($mergedOptions as $key => $val) { |
183 | 183 | // q: can php be built without ctype? should we use a regexp? |
184 | 184 | if (is_string($key) && !ctype_digit($key)) { |
185 | - switch($key) { |
|
185 | + switch ($key) { |
|
186 | 186 | case 'target_charset': |
187 | 187 | if (function_exists('mb_convert_encoding')) { |
188 | 188 | $this->current_parsing_options['target_charset'] = $val; |
189 | 189 | } else { |
190 | - $this->getLogger()->errorLog('XML-RPC: ' . __METHOD__ . ": 'target_charset' option is unsupported without mbstring"); |
|
190 | + $this->getLogger()->errorLog('XML-RPC: '.__METHOD__.": 'target_charset' option is unsupported without mbstring"); |
|
191 | 191 | } |
192 | 192 | break; |
193 | 193 | |
@@ -198,7 +198,7 @@ discard block |
||
198 | 198 | //$this->_xh['isf'] = 4; |
199 | 199 | //$this->_xh['isf_reason'] = "Callback passed as 'methodname_callback' is not callable"; |
200 | 200 | //return; |
201 | - $this->getLogger()->errorLog('XML-RPC: ' . __METHOD__ . ": Callback passed as 'methodname_callback' is not callable"); |
|
201 | + $this->getLogger()->errorLog('XML-RPC: '.__METHOD__.": Callback passed as 'methodname_callback' is not callable"); |
|
202 | 202 | } |
203 | 203 | break; |
204 | 204 | |
@@ -209,7 +209,7 @@ discard block |
||
209 | 209 | break; |
210 | 210 | |
211 | 211 | default: |
212 | - $this->getLogger()->errorLog('XML-RPC: ' . __METHOD__ . ": unsupported option: $key"); |
|
212 | + $this->getLogger()->errorLog('XML-RPC: '.__METHOD__.": unsupported option: $key"); |
|
213 | 213 | } |
214 | 214 | unset($mergedOptions[$key]); |
215 | 215 | } |
@@ -255,10 +255,10 @@ discard block |
||
255 | 255 | |
256 | 256 | try { |
257 | 257 | // @see ticket #70 - we have to parse big xml docs in chunks to avoid errors |
258 | - for ($offset = 0; $offset < $len; $offset += $this->maxChunkLength) { |
|
258 | + for ($offset = 0; $offset<$len; $offset += $this->maxChunkLength) { |
|
259 | 259 | $chunk = substr($data, $offset, $this->maxChunkLength); |
260 | 260 | // error handling: xml not well formed |
261 | - if (!xml_parse($parser, $chunk, $offset + $this->maxChunkLength >= $len)) { |
|
261 | + if (!xml_parse($parser, $chunk, $offset+$this->maxChunkLength>=$len)) { |
|
262 | 262 | $errCode = xml_get_error_code($parser); |
263 | 263 | $errStr = sprintf('XML error %s: %s at line %d, column %d', $errCode, xml_error_string($errCode), |
264 | 264 | xml_get_current_line_number($parser), xml_get_current_column_number($parser)); |
@@ -268,7 +268,7 @@ discard block |
||
268 | 268 | break; |
269 | 269 | } |
270 | 270 | // no need to parse further if we already have a fatal error |
271 | - if ($this->_xh['isf'] >= 2) { |
|
271 | + if ($this->_xh['isf']>=2) { |
|
272 | 272 | break; |
273 | 273 | } |
274 | 274 | } |
@@ -300,7 +300,7 @@ discard block |
||
300 | 300 | public function xmlrpc_se($parser, $name, $attrs, $acceptSingleVals = false) |
301 | 301 | { |
302 | 302 | // if invalid xml-rpc already detected, skip all processing |
303 | - if ($this->_xh['isf'] >= 2) { |
|
303 | + if ($this->_xh['isf']>=2) { |
|
304 | 304 | return; |
305 | 305 | } |
306 | 306 | |
@@ -323,7 +323,7 @@ discard block |
||
323 | 323 | $this->_xh['rt'] = strtolower($name); |
324 | 324 | } else { |
325 | 325 | $this->_xh['isf'] = 2; |
326 | - $this->_xh['isf_reason'] = 'missing top level xmlrpc element. Found: ' . $name; |
|
326 | + $this->_xh['isf_reason'] = 'missing top level xmlrpc element. Found: '.$name; |
|
327 | 327 | |
328 | 328 | return; |
329 | 329 | } |
@@ -426,7 +426,7 @@ discard block |
||
426 | 426 | case 'MEMBER': |
427 | 427 | // set member name to null, in case we do not find in the xml later on |
428 | 428 | /// @todo we could reject structs missing a NAME in the MEMBER element |
429 | - $this->_xh['valuestack'][count($this->_xh['valuestack']) - 1]['name'] = ''; |
|
429 | + $this->_xh['valuestack'][count($this->_xh['valuestack'])-1]['name'] = ''; |
|
430 | 430 | //$this->_xh['ac']=''; |
431 | 431 | // Drop trough intentionally |
432 | 432 | |
@@ -498,7 +498,7 @@ discard block |
||
498 | 498 | */ |
499 | 499 | public function xmlrpc_ee($parser, $name, $rebuildXmlrpcvals = 1) |
500 | 500 | { |
501 | - if ($this->_xh['isf'] >= 2) { |
|
501 | + if ($this->_xh['isf']>=2) { |
|
502 | 502 | return; |
503 | 503 | |
504 | 504 | } |
@@ -520,7 +520,7 @@ discard block |
||
520 | 520 | $this->_xh['value'] = mb_convert_encoding($this->_xh['value'], $this->current_parsing_options['target_charset'], 'UTF-8'); |
521 | 521 | } |
522 | 522 | |
523 | - if ($rebuildXmlrpcvals > 0) { |
|
523 | + if ($rebuildXmlrpcvals>0) { |
|
524 | 524 | // build the xml-rpc val out of the data received, and substitute it |
525 | 525 | $temp = new Value($this->_xh['value'], $this->_xh['vt']); |
526 | 526 | // in case we got info about underlying php class, save it in the object we're rebuilding |
@@ -528,15 +528,15 @@ discard block |
||
528 | 528 | $temp->_php_class = $this->_xh['php_class']; |
529 | 529 | } |
530 | 530 | $this->_xh['value'] = $temp; |
531 | - } elseif ($rebuildXmlrpcvals < 0) { |
|
531 | + } elseif ($rebuildXmlrpcvals<0) { |
|
532 | 532 | if ($this->_xh['vt'] == Value::$xmlrpcDateTime) { |
533 | - $this->_xh['value'] = (object)array( |
|
533 | + $this->_xh['value'] = (object) array( |
|
534 | 534 | 'xmlrpc_type' => 'datetime', |
535 | 535 | 'scalar' => $this->_xh['value'], |
536 | 536 | 'timestamp' => \PhpXmlRpc\Helper\Date::iso8601Decode($this->_xh['value']) |
537 | 537 | ); |
538 | 538 | } elseif ($this->_xh['vt'] == Value::$xmlrpcBase64) { |
539 | - $this->_xh['value'] = (object)array( |
|
539 | + $this->_xh['value'] = (object) array( |
|
540 | 540 | 'xmlrpc_type' => 'base64', |
541 | 541 | 'scalar' => $this->_xh['value'] |
542 | 542 | ); |
@@ -551,8 +551,8 @@ discard block |
||
551 | 551 | // check if we are inside an array or struct: |
552 | 552 | // if value just built is inside an array, let's move it into array on the stack |
553 | 553 | $vscount = count($this->_xh['valuestack']); |
554 | - if ($vscount && $this->_xh['valuestack'][$vscount - 1]['type'] == 'ARRAY') { |
|
555 | - $this->_xh['valuestack'][$vscount - 1]['values'][] = $this->_xh['value']; |
|
554 | + if ($vscount && $this->_xh['valuestack'][$vscount-1]['type'] == 'ARRAY') { |
|
555 | + $this->_xh['valuestack'][$vscount-1]['values'][] = $this->_xh['value']; |
|
556 | 556 | } |
557 | 557 | break; |
558 | 558 | |
@@ -579,11 +579,11 @@ discard block |
||
579 | 579 | // log if receiving something strange, even though we set the value to false anyway |
580 | 580 | /// @todo to be consistent with the other types, we should return a value outside the good-value domain, e.g. NULL |
581 | 581 | if ($this->_xh['ac'] != '0' && strcasecmp($this->_xh['ac'], 'false') !== 0) { |
582 | - $this->getLogger()->errorLog('XML-RPC: ' . __METHOD__ . ': invalid data received in BOOLEAN value: ' . $this->_xh['ac']); |
|
582 | + $this->getLogger()->errorLog('XML-RPC: '.__METHOD__.': invalid data received in BOOLEAN value: '.$this->_xh['ac']); |
|
583 | 583 | if ($this->current_parsing_options['xmlrpc_reject_invalid_values']) |
584 | 584 | { |
585 | 585 | $this->_xh['isf'] = 2; |
586 | - $this->_xh['isf_reason'] = 'Invalid data received in BOOLEAN value: ' . $this->_xh['ac']; |
|
586 | + $this->_xh['isf_reason'] = 'Invalid data received in BOOLEAN value: '.$this->_xh['ac']; |
|
587 | 587 | return; |
588 | 588 | } |
589 | 589 | } |
@@ -602,18 +602,18 @@ discard block |
||
602 | 602 | $this->_xh['vt'] = strtolower($name); |
603 | 603 | $this->_xh['lv'] = 3; // indicate we've found a value |
604 | 604 | if (!preg_match(PhpXmlRpc::$xmlrpc_int_format, $this->_xh['ac'])) { |
605 | - $this->getLogger()->errorLog('XML-RPC: ' . __METHOD__ . ': non numeric data received in INT: ' . $this->_xh['ac']); |
|
605 | + $this->getLogger()->errorLog('XML-RPC: '.__METHOD__.': non numeric data received in INT: '.$this->_xh['ac']); |
|
606 | 606 | if ($this->current_parsing_options['xmlrpc_reject_invalid_values']) |
607 | 607 | { |
608 | 608 | $this->_xh['isf'] = 2; |
609 | - $this->_xh['isf_reason'] = 'Non numeric data received in INT value: ' . $this->_xh['ac']; |
|
609 | + $this->_xh['isf_reason'] = 'Non numeric data received in INT value: '.$this->_xh['ac']; |
|
610 | 610 | return; |
611 | 611 | } |
612 | 612 | /// @todo: find a better way of reporting an error value than this! Use NaN? |
613 | 613 | $this->_xh['value'] = 'ERROR_NON_NUMERIC_FOUND'; |
614 | 614 | } else { |
615 | 615 | // it's ok, add it on |
616 | - $this->_xh['value'] = (int)$this->_xh['ac']; |
|
616 | + $this->_xh['value'] = (int) $this->_xh['ac']; |
|
617 | 617 | } |
618 | 618 | break; |
619 | 619 | |
@@ -621,18 +621,18 @@ discard block |
||
621 | 621 | $this->_xh['vt'] = Value::$xmlrpcDouble; |
622 | 622 | $this->_xh['lv'] = 3; // indicate we've found a value |
623 | 623 | if (!preg_match(PhpXmlRpc::$xmlrpc_double_format, $this->_xh['ac'])) { |
624 | - $this->getLogger()->errorLog('XML-RPC: ' . __METHOD__ . ': non numeric data received in DOUBLE value: ' . $this->_xh['ac']); |
|
624 | + $this->getLogger()->errorLog('XML-RPC: '.__METHOD__.': non numeric data received in DOUBLE value: '.$this->_xh['ac']); |
|
625 | 625 | if ($this->current_parsing_options['xmlrpc_reject_invalid_values']) |
626 | 626 | { |
627 | 627 | $this->_xh['isf'] = 2; |
628 | - $this->_xh['isf_reason'] = 'Non numeric data received in DOUBLE value: ' . $this->_xh['ac']; |
|
628 | + $this->_xh['isf_reason'] = 'Non numeric data received in DOUBLE value: '.$this->_xh['ac']; |
|
629 | 629 | return; |
630 | 630 | } |
631 | 631 | |
632 | 632 | $this->_xh['value'] = 'ERROR_NON_NUMERIC_FOUND'; |
633 | 633 | } else { |
634 | 634 | // it's ok, add it on |
635 | - $this->_xh['value'] = (double)$this->_xh['ac']; |
|
635 | + $this->_xh['value'] = (double) $this->_xh['ac']; |
|
636 | 636 | } |
637 | 637 | break; |
638 | 638 | |
@@ -640,20 +640,20 @@ discard block |
||
640 | 640 | $this->_xh['vt'] = Value::$xmlrpcDateTime; |
641 | 641 | $this->_xh['lv'] = 3; // indicate we've found a value |
642 | 642 | if (!preg_match(PhpXmlRpc::$xmlrpc_datetime_format, $this->_xh['ac'])) { |
643 | - $this->getLogger()->errorLog('XML-RPC: ' . __METHOD__ . ': invalid data received in DATETIME value: ' . $this->_xh['ac']); |
|
643 | + $this->getLogger()->errorLog('XML-RPC: '.__METHOD__.': invalid data received in DATETIME value: '.$this->_xh['ac']); |
|
644 | 644 | if ($this->current_parsing_options['xmlrpc_reject_invalid_values']) |
645 | 645 | { |
646 | 646 | $this->_xh['isf'] = 2; |
647 | - $this->_xh['isf_reason'] = 'Invalid data received in DATETIME value: ' . $this->_xh['ac']; |
|
647 | + $this->_xh['isf_reason'] = 'Invalid data received in DATETIME value: '.$this->_xh['ac']; |
|
648 | 648 | return; |
649 | 649 | } |
650 | 650 | } |
651 | 651 | if ($this->current_parsing_options['xmlrpc_return_datetimes']) { |
652 | 652 | try { |
653 | 653 | $this->_xh['value'] = new \DateTime($this->_xh['ac']); |
654 | - } catch(\Exception $e) { |
|
654 | + } catch (\Exception $e) { |
|
655 | 655 | // q: what to do? we can not guarantee that a valid date can be created. Return null or throw? |
656 | - $this->getLogger()->errorLog('XML-RPC: ' . __METHOD__ . ': ' . $e->getMessage()); |
|
656 | + $this->getLogger()->errorLog('XML-RPC: '.__METHOD__.': '.$e->getMessage()); |
|
657 | 657 | $this->_xh['value'] = null; |
658 | 658 | } |
659 | 659 | } else { |
@@ -667,7 +667,7 @@ discard block |
||
667 | 667 | if ($this->current_parsing_options['xmlrpc_reject_invalid_values']) { |
668 | 668 | $v = base64_decode($this->_xh['ac'], true); |
669 | 669 | if ($v === false) { |
670 | - $this->getLogger()->errorLog('XML-RPC: ' . __METHOD__ . ': invalid data received in BASE64 value'); |
|
670 | + $this->getLogger()->errorLog('XML-RPC: '.__METHOD__.': invalid data received in BASE64 value'); |
|
671 | 671 | $this->_xh['isf'] = 2; |
672 | 672 | $this->_xh['isf_reason'] = 'Invalid data received in BASE64 value'; |
673 | 673 | return; |
@@ -676,14 +676,14 @@ discard block |
||
676 | 676 | $v = base64_decode($this->_xh['ac']); |
677 | 677 | if ($v === '' && $this->_xh['ac'] !== '') { |
678 | 678 | // only the empty string should decode to the empty string |
679 | - $this->getLogger()->errorLog('XML-RPC: ' . __METHOD__ . ': invalid data received in BASE64 value'); |
|
679 | + $this->getLogger()->errorLog('XML-RPC: '.__METHOD__.': invalid data received in BASE64 value'); |
|
680 | 680 | } |
681 | 681 | } |
682 | 682 | $this->_xh['value'] = $v; |
683 | 683 | break; |
684 | 684 | |
685 | 685 | case 'NAME': |
686 | - $this->_xh['valuestack'][count($this->_xh['valuestack']) - 1]['name'] = $this->_xh['ac']; |
|
686 | + $this->_xh['valuestack'][count($this->_xh['valuestack'])-1]['name'] = $this->_xh['ac']; |
|
687 | 687 | break; |
688 | 688 | |
689 | 689 | case 'MEMBER': |
@@ -693,14 +693,14 @@ discard block |
||
693 | 693 | // NB: atm we always initialize members with an empty name in xmlrpc__ee, so no need for this check. |
694 | 694 | // We could make parsing stricter though... |
695 | 695 | //if (isset($this->_xh['valuestack'][$vscount - 1]['name'])) { |
696 | - $this->_xh['valuestack'][$vscount - 1]['values'][$this->_xh['valuestack'][$vscount - 1]['name']] = $this->_xh['value']; |
|
696 | + $this->_xh['valuestack'][$vscount-1]['values'][$this->_xh['valuestack'][$vscount-1]['name']] = $this->_xh['value']; |
|
697 | 697 | //} else { |
698 | 698 | // /// @todo return a parsing error if $this->current_parsing_options['xmlrpc_reject_invalid_values']? |
699 | 699 | // $this->getLogger()->errorLog('XML-RPC: ' . __METHOD__ . ': missing NAME inside STRUCT in received xml'); |
700 | 700 | //} |
701 | 701 | } else { |
702 | 702 | /// @todo return a parsing error $this->current_parsing_options['xmlrpc_reject_invalid_values']? |
703 | - $this->getLogger()->errorLog('XML-RPC: ' . __METHOD__ . ': missing VALUE inside STRUCT in received xml'); |
|
703 | + $this->getLogger()->errorLog('XML-RPC: '.__METHOD__.': missing VALUE inside STRUCT in received xml'); |
|
704 | 704 | } |
705 | 705 | break; |
706 | 706 | |
@@ -726,7 +726,7 @@ discard block |
||
726 | 726 | $this->_xh['pt'][] = $this->_xh['vt']; |
727 | 727 | } else { |
728 | 728 | /// @todo return a parsing error? esp. if if ($this->current_parsing_options['xmlrpc_reject_invalid_values']) |
729 | - $this->getLogger()->errorLog('XML-RPC: ' . __METHOD__ . ': missing VALUE inside PARAM in received xml'); |
|
729 | + $this->getLogger()->errorLog('XML-RPC: '.__METHOD__.': missing VALUE inside PARAM in received xml'); |
|
730 | 730 | } |
731 | 731 | break; |
732 | 732 | |
@@ -805,7 +805,7 @@ discard block |
||
805 | 805 | public function xmlrpc_cd($parser, $data) |
806 | 806 | { |
807 | 807 | // skip processing if xml fault already detected |
808 | - if ($this->_xh['isf'] >= 2) { |
|
808 | + if ($this->_xh['isf']>=2) { |
|
809 | 809 | return; |
810 | 810 | } |
811 | 811 | |
@@ -827,7 +827,7 @@ discard block |
||
827 | 827 | public function xmlrpc_dh($parser, $data) |
828 | 828 | { |
829 | 829 | // skip processing if xml fault already detected |
830 | - if ($this->_xh['isf'] >= 2) { |
|
830 | + if ($this->_xh['isf']>=2) { |
|
831 | 831 | return; |
832 | 832 | } |
833 | 833 | |
@@ -901,8 +901,8 @@ discard block |
||
901 | 901 | // Details: |
902 | 902 | // SPACE: (#x20 | #x9 | #xD | #xA)+ === [ \x9\xD\xA]+ |
903 | 903 | // EQ: SPACE?=SPACE? === [ \x9\xD\xA]*=[ \x9\xD\xA]* |
904 | - if (preg_match('/^<\?xml\s+version\s*=\s*' . "((?:\"[a-zA-Z0-9_.:-]+\")|(?:'[a-zA-Z0-9_.:-]+'))" . |
|
905 | - '\s+encoding\s*=\s*' . "((?:\"[A-Za-z][A-Za-z0-9._-]*\")|(?:'[A-Za-z][A-Za-z0-9._-]*'))/", |
|
904 | + if (preg_match('/^<\?xml\s+version\s*=\s*'."((?:\"[a-zA-Z0-9_.:-]+\")|(?:'[a-zA-Z0-9_.:-]+'))". |
|
905 | + '\s+encoding\s*=\s*'."((?:\"[A-Za-z][A-Za-z0-9._-]*\")|(?:'[A-Za-z][A-Za-z0-9._-]*'))/", |
|
906 | 906 | $xmlChunk, $matches)) { |
907 | 907 | return strtoupper(substr($matches[2], 1, -1)); |
908 | 908 | } |
@@ -920,7 +920,7 @@ discard block |
||
920 | 920 | // NB: mb_detect likes to call it ascii, xml parser likes to call it US_ASCII... |
921 | 921 | // IANA also likes better US-ASCII, so go with it |
922 | 922 | if ($enc == 'ASCII') { |
923 | - $enc = 'US-' . $enc; |
|
923 | + $enc = 'US-'.$enc; |
|
924 | 924 | } |
925 | 925 | |
926 | 926 | return $enc; |
@@ -957,8 +957,8 @@ discard block |
||
957 | 957 | // Details: |
958 | 958 | // SPACE: (#x20 | #x9 | #xD | #xA)+ === [ \x9\xD\xA]+ |
959 | 959 | // EQ: SPACE?=SPACE? === [ \x9\xD\xA]*=[ \x9\xD\xA]* |
960 | - if (preg_match('/^<\?xml\s+version\s*=\s*' . "((?:\"[a-zA-Z0-9_.:-]+\")|(?:'[a-zA-Z0-9_.:-]+'))" . |
|
961 | - '\s+encoding\s*=\s*' . "((?:\"[A-Za-z][A-Za-z0-9._-]*\")|(?:'[A-Za-z][A-Za-z0-9._-]*'))/", |
|
960 | + if (preg_match('/^<\?xml\s+version\s*=\s*'."((?:\"[a-zA-Z0-9_.:-]+\")|(?:'[a-zA-Z0-9_.:-]+'))". |
|
961 | + '\s+encoding\s*=\s*'."((?:\"[A-Za-z][A-Za-z0-9._-]*\")|(?:'[A-Za-z][A-Za-z0-9._-]*'))/", |
|
962 | 962 | $xmlChunk)) { |
963 | 963 | return true; |
964 | 964 | } |
@@ -978,7 +978,7 @@ discard block |
||
978 | 978 | break; |
979 | 979 | default: |
980 | 980 | $trace = debug_backtrace(DEBUG_BACKTRACE_IGNORE_ARGS); |
981 | - trigger_error('Undefined property via __set(): ' . $name . ' in ' . $trace[0]['file'] . ' on line ' . $trace[0]['line'], E_USER_WARNING); |
|
981 | + trigger_error('Undefined property via __set(): '.$name.' in '.$trace[0]['file'].' on line '.$trace[0]['line'], E_USER_WARNING); |
|
982 | 982 | } |
983 | 983 | } |
984 | 984 | |
@@ -1002,7 +1002,7 @@ discard block |
||
1002 | 1002 | break; |
1003 | 1003 | default: |
1004 | 1004 | $trace = debug_backtrace(DEBUG_BACKTRACE_IGNORE_ARGS); |
1005 | - trigger_error('Undefined property via __unset(): ' . $name . ' in ' . $trace[0]['file'] . ' on line ' . $trace[0]['line'], E_USER_WARNING); |
|
1005 | + trigger_error('Undefined property via __unset(): '.$name.' in '.$trace[0]['file'].' on line '.$trace[0]['line'], E_USER_WARNING); |
|
1006 | 1006 | } |
1007 | 1007 | } |
1008 | 1008 | } |