@@ -2,12 +2,12 @@ discard block |
||
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 | -include_once __DIR__ . '/PolyfillTestCase.php'; |
|
10 | +include_once __DIR__.'/PolyfillTestCase.php'; |
|
11 | 11 | |
12 | 12 | use PHPUnit\Runner\BaseTestRunner; |
13 | 13 | |
@@ -65,7 +65,7 @@ discard block |
||
65 | 65 | |
66 | 66 | public function testUnicodeInMemberName() |
67 | 67 | { |
68 | - $str = "G" . chr(252) . "nter, El" . chr(232) . "ne"; |
|
68 | + $str = "G".chr(252)."nter, El".chr(232)."ne"; |
|
69 | 69 | $v = array($str => new xmlrpcval(1)); |
70 | 70 | $r = new xmlrpcresp(new xmlrpcval($v, 'struct')); |
71 | 71 | $r = $r->serialize(); |
@@ -81,7 +81,7 @@ discard block |
||
81 | 81 | '<?xml version="1.0"?> |
82 | 82 | <!-- $Id --> |
83 | 83 | <!-- found by G. Giunta, covers what happens when lib receives UTF8 chars in response text and comments --> |
84 | -<!-- ' . chr(224) . chr(252) . chr(232) . 'àüè --> |
|
84 | +<!-- ' . chr(224).chr(252).chr(232).'àüè --> |
|
85 | 85 | <methodResponse> |
86 | 86 | <fault> |
87 | 87 | <value> |
@@ -92,7 +92,7 @@ discard block |
||
92 | 92 | </member> |
93 | 93 | <member> |
94 | 94 | <name>faultString</name> |
95 | -<value><string>' . chr(224) . chr(252) . chr(232) . 'àüè</string></value> |
|
95 | +<value><string>' . chr(224).chr(252).chr(232).'àüè</string></value> |
|
96 | 96 | </member> |
97 | 97 | </struct> |
98 | 98 | </value> |
@@ -101,7 +101,7 @@ discard block |
||
101 | 101 | $m = $this->newMsg('dummy'); |
102 | 102 | $r = $m->parseResponse($response); |
103 | 103 | $v = $r->faultString(); |
104 | - $this->assertEquals(chr(224) . chr(252) . chr(232) . chr(224) . chr(252) . chr(232), $v); |
|
104 | + $this->assertEquals(chr(224).chr(252).chr(232).chr(224).chr(252).chr(232), $v); |
|
105 | 105 | } |
106 | 106 | |
107 | 107 | public function testValidNumbers() |
@@ -162,7 +162,7 @@ discard block |
||
162 | 162 | |
163 | 163 | public function testI8() |
164 | 164 | { |
165 | - if (PHP_INT_SIZE == 4 ) { |
|
165 | + if (PHP_INT_SIZE == 4) { |
|
166 | 166 | $this->markTestSkipped('Can not test i8 as php is compiled in 32 bit mode'); |
167 | 167 | return; |
168 | 168 | } |
@@ -485,11 +485,11 @@ discard block |
||
485 | 485 | |
486 | 486 | public function testUTF8Response() |
487 | 487 | { |
488 | - $string = chr(224) . chr(252) . chr(232); |
|
488 | + $string = chr(224).chr(252).chr(232); |
|
489 | 489 | |
490 | 490 | $s = $this->newMsg('dummy'); |
491 | - $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> |
|
492 | -<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> |
|
491 | + $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> |
|
492 | +<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> |
|
493 | 493 | '; |
494 | 494 | $r = $s->parseResponse($f, false, 'phpvals'); |
495 | 495 | $v = $r->value(); |
@@ -497,7 +497,7 @@ discard block |
||
497 | 497 | $this->assertEquals($string, $v); |
498 | 498 | |
499 | 499 | $f = '<?xml version="1.0" encoding="UTF-8"?><methodResponse><params><param><value><struct><member><name>userid</name><value>311127</value></member> |
500 | -<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> |
|
500 | +<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> |
|
501 | 501 | '; |
502 | 502 | $r = $s->parseResponse($f, false, 'phpvals'); |
503 | 503 | $v = $r->value(); |
@@ -512,11 +512,11 @@ discard block |
||
512 | 512 | |
513 | 513 | public function testLatin1Response() |
514 | 514 | { |
515 | - $string = chr(224) . chr(252) . chr(232); |
|
515 | + $string = chr(224).chr(252).chr(232); |
|
516 | 516 | |
517 | 517 | $s = $this->newMsg('dummy'); |
518 | - $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> |
|
519 | -<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> |
|
518 | + $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> |
|
519 | +<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> |
|
520 | 520 | '; |
521 | 521 | $r = $s->parseResponse($f, false, 'phpvals'); |
522 | 522 | $v = $r->value(); |
@@ -524,7 +524,7 @@ discard block |
||
524 | 524 | $this->assertEquals($string, $v); |
525 | 525 | |
526 | 526 | $f = '<?xml version="1.0" encoding="ISO-8859-1"?><methodResponse><params><param><value><struct><member><name>userid</name><value>311127</value></member> |
527 | -<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> |
|
527 | +<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> |
|
528 | 528 | '; |
529 | 529 | $r = $s->parseResponse($f, false, 'phpvals'); |
530 | 530 | $v = $r->value(); |
@@ -619,7 +619,7 @@ discard block |
||
619 | 619 | $this->assertequals(1, count($v1)); |
620 | 620 | $out = array('me' => array(), 'mytype' => 2, '_php_class' => null); |
621 | 621 | |
622 | - foreach($v1 as $key => $val) |
|
622 | + foreach ($v1 as $key => $val) |
|
623 | 623 | { |
624 | 624 | $this->assertArrayHasKey($key, $out); |
625 | 625 | $expected = $out[$key]; |
@@ -634,7 +634,7 @@ discard block |
||
634 | 634 | $this->assertequals(2, count($v2)); |
635 | 635 | $out = array(array('key' => 0, 'value' => 'object'), array('key' => 1, 'value' => 'object')); |
636 | 636 | $i = 0; |
637 | - foreach($v2 as $key => $val) |
|
637 | + foreach ($v2 as $key => $val) |
|
638 | 638 | { |
639 | 639 | $expected = $out[$i]; |
640 | 640 | $this->assertequals($expected['key'], $key); |
@@ -647,7 +647,7 @@ discard block |
||
647 | 647 | { |
648 | 648 | // nb: make sure that the serialized xml corresponding to this is > 10MB in size |
649 | 649 | $data = array(); |
650 | - for ($i = 0; $i < 500000; $i++ ) { |
|
650 | + for ($i = 0; $i<500000; $i++) { |
|
651 | 651 | $data[] = 'hello world'; |
652 | 652 | } |
653 | 653 |
@@ -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,8 +1,8 @@ discard block |
||
1 | 1 | <?php |
2 | 2 | |
3 | -include_once __DIR__ . '/parse_args.php'; |
|
3 | +include_once __DIR__.'/parse_args.php'; |
|
4 | 4 | |
5 | -include_once __DIR__ . '/PolyfillTestCase.php'; |
|
5 | +include_once __DIR__.'/PolyfillTestCase.php'; |
|
6 | 6 | |
7 | 7 | use PHPUnit\Extensions\SeleniumCommon\RemoteCoverage; |
8 | 8 | |
@@ -28,7 +28,7 @@ discard block |
||
28 | 28 | */ |
29 | 29 | public function _run($result = NULL) |
30 | 30 | { |
31 | - $this->testId = get_class($this) . '__' . $this->getName(); |
|
31 | + $this->testId = get_class($this).'__'.$this->getName(); |
|
32 | 32 | |
33 | 33 | if ($result === NULL) { |
34 | 34 | $result = $this->createResult(); |
@@ -56,7 +56,7 @@ discard block |
||
56 | 56 | |
57 | 57 | protected function request($file, $method = 'GET', $payload = '', $emptyPageOk = false) |
58 | 58 | { |
59 | - $url = $this->baseUrl . $file; |
|
59 | + $url = $this->baseUrl.$file; |
|
60 | 60 | |
61 | 61 | $ch = curl_init($url); |
62 | 62 | curl_setopt_array($ch, array( |
@@ -74,7 +74,7 @@ discard block |
||
74 | 74 | { |
75 | 75 | curl_setopt($ch, CURLOPT_COOKIE, 'PHPUNIT_SELENIUM_TEST_ID='.$this->testId); |
76 | 76 | } |
77 | - if ($this->args['DEBUG'] > 0) { |
|
77 | + if ($this->args['DEBUG']>0) { |
|
78 | 78 | curl_setopt($ch, CURLOPT_VERBOSE, 1); |
79 | 79 | } |
80 | 80 | $page = curl_exec($ch); |
@@ -2,20 +2,20 @@ |
||
2 | 2 | |
3 | 3 | use PHPUnit\Runner\Version as PHPUnit_Version; |
4 | 4 | |
5 | -if ( class_exists( 'PHPUnit_Extensions_SeleniumCommon_RemoteCoverage' ) === true |
|
6 | - && class_exists( 'PHPUnit\Extensions\SeleniumCommon\RemoteCoverage' ) === false |
|
5 | +if (class_exists('PHPUnit_Extensions_SeleniumCommon_RemoteCoverage') === true |
|
6 | + && class_exists('PHPUnit\Extensions\SeleniumCommon\RemoteCoverage') === false |
|
7 | 7 | ) { |
8 | - class_alias( 'PHPUnit_Extensions_SeleniumCommon_RemoteCoverage', 'PHPUnit\Extensions\SeleniumCommon\RemoteCoverage' ); |
|
8 | + class_alias('PHPUnit_Extensions_SeleniumCommon_RemoteCoverage', 'PHPUnit\Extensions\SeleniumCommon\RemoteCoverage'); |
|
9 | 9 | } |
10 | 10 | |
11 | -if ( class_exists( 'PHPUnit_Runner_BaseTestRunner' ) === true |
|
12 | - && class_exists( 'PHPUnit\Runner\BaseTestRunner' ) === false |
|
11 | +if (class_exists('PHPUnit_Runner_BaseTestRunner') === true |
|
12 | + && class_exists('PHPUnit\Runner\BaseTestRunner') === false |
|
13 | 13 | ) { |
14 | - class_alias( 'PHPUnit_Runner_BaseTestRunner', 'PHPUnit\Runner\BaseTestRunner' ); |
|
14 | + class_alias('PHPUnit_Runner_BaseTestRunner', 'PHPUnit\Runner\BaseTestRunner'); |
|
15 | 15 | } |
16 | 16 | |
17 | 17 | if (class_exists(PHPUnit_Version::class) === false || version_compare(PHPUnit_Version::id(), '8.0.0', '<')) { |
18 | - include_once __DIR__ . '/PolyfillTestCase7.php'; |
|
18 | + include_once __DIR__.'/PolyfillTestCase7.php'; |
|
19 | 19 | } else { |
20 | - include_once __DIR__ . '/PolyfillTestCase8.php'; |
|
20 | + include_once __DIR__.'/PolyfillTestCase8.php'; |
|
21 | 21 | } |
@@ -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__ . '/PolyfillTestCase.php'; |
|
8 | +include_once __DIR__.'/PolyfillTestCase.php'; |
|
9 | 9 | |
10 | 10 | use PHPUnit\Extensions\SeleniumCommon\RemoteCoverage; |
11 | 11 | use PHPUnit\Framework\TestResult; |
@@ -41,7 +41,7 @@ discard block |
||
41 | 41 | // (but only if not called from subclass objects / multitests) |
42 | 42 | if (function_exists('debug_backtrace') && strtolower(get_called_class()) == 'localhosttests') { |
43 | 43 | $trace = debug_backtrace(DEBUG_BACKTRACE_IGNORE_ARGS); |
44 | - for ($i = 0; $i < count($trace); $i++) { |
|
44 | + for ($i = 0; $i<count($trace); $i++) { |
|
45 | 45 | if (strpos($trace[$i]['function'], 'test') === 0) { |
46 | 46 | self::$failed_tests[$trace[$i]['function']] = true; |
47 | 47 | break; |
@@ -64,7 +64,7 @@ discard block |
||
64 | 64 | */ |
65 | 65 | public function _run($result = NULL) |
66 | 66 | { |
67 | - $this->testId = get_class($this) . '__' . $this->getName(); |
|
67 | + $this->testId = get_class($this).'__'.$this->getName(); |
|
68 | 68 | |
69 | 69 | if ($result === NULL) { |
70 | 70 | $result = $this->createResult(); |
@@ -95,7 +95,7 @@ discard block |
||
95 | 95 | $this->args = argParser::getArgs(); |
96 | 96 | |
97 | 97 | $server = explode(':', $this->args['HTTPSERVER']); |
98 | - if (count($server) > 1) { |
|
98 | + if (count($server)>1) { |
|
99 | 99 | $this->client = new xmlrpc_client($this->args['HTTPURI'], $server[0], $server[1]); |
100 | 100 | } else { |
101 | 101 | $this->client = new xmlrpc_client($this->args['HTTPURI'], $this->args['HTTPSERVER']); |
@@ -105,7 +105,7 @@ discard block |
||
105 | 105 | $this->client->request_compression = $this->request_compression; |
106 | 106 | $this->client->accepted_compression = $this->accepted_compression; |
107 | 107 | |
108 | - $this->coverageScriptUrl = 'http://' . $this->args['HTTPSERVER'] . '/' . str_replace( '/demo/server/server.php', 'tests/phpunit_coverage.php', $this->args['HTTPURI'] ); |
|
108 | + $this->coverageScriptUrl = 'http://'.$this->args['HTTPSERVER'].'/'.str_replace('/demo/server/server.php', 'tests/phpunit_coverage.php', $this->args['HTTPURI']); |
|
109 | 109 | |
110 | 110 | if ($this->args['DEBUG'] == 1) |
111 | 111 | ob_start(); |
@@ -141,9 +141,9 @@ discard block |
||
141 | 141 | return $r; |
142 | 142 | } |
143 | 143 | if (is_array($errorCode)) { |
144 | - $this->assertContains($r->faultCode(), $errorCode, 'Error ' . $r->faultCode() . ' connecting to server: ' . $r->faultString()); |
|
144 | + $this->assertContains($r->faultCode(), $errorCode, 'Error '.$r->faultCode().' connecting to server: '.$r->faultString()); |
|
145 | 145 | } else { |
146 | - $this->assertEquals($errorCode, $r->faultCode(), 'Error ' . $r->faultCode() . ' connecting to server: ' . $r->faultString()); |
|
146 | + $this->assertEquals($errorCode, $r->faultCode(), 'Error '.$r->faultCode().' connecting to server: '.$r->faultString()); |
|
147 | 147 | } |
148 | 148 | if (!$r->faultCode()) { |
149 | 149 | if ($returnResponse) { |
@@ -165,20 +165,20 @@ discard block |
||
165 | 165 | $query = parse_url($this->client->path, PHP_URL_QUERY); |
166 | 166 | parse_str($query, $vars); |
167 | 167 | $query = http_build_query(array_merge($vars, $data)); |
168 | - $this->client->path = parse_url($this->client->path, PHP_URL_PATH) . '?' . $query; |
|
168 | + $this->client->path = parse_url($this->client->path, PHP_URL_PATH).'?'.$query; |
|
169 | 169 | } |
170 | 170 | |
171 | 171 | public function testString() |
172 | 172 | { |
173 | - $sendString = "here are 3 \"entities\": < > & " . |
|
174 | - "and here's a dollar sign: \$pretendvarname and a backslash too: " . chr(92) . |
|
175 | - " - isn't that great? \\\"hackery\\\" at it's best " . |
|
176 | - " also don't want to miss out on \$item[0]. " . |
|
177 | - "The real weird stuff follows: CRLF here" . chr(13) . chr(10) . |
|
178 | - "a simple CR here" . chr(13) . |
|
179 | - "a simple LF here" . chr(10) . |
|
180 | - "and then LFCR" . chr(10) . chr(13) . |
|
181 | - "last but not least weird names: G" . chr(252) . "nter, El" . chr(232) . "ne, and an xml comment closing tag: -->"; |
|
173 | + $sendString = "here are 3 \"entities\": < > & ". |
|
174 | + "and here's a dollar sign: \$pretendvarname and a backslash too: ".chr(92). |
|
175 | + " - isn't that great? \\\"hackery\\\" at it's best ". |
|
176 | + " also don't want to miss out on \$item[0]. ". |
|
177 | + "The real weird stuff follows: CRLF here".chr(13).chr(10). |
|
178 | + "a simple CR here".chr(13). |
|
179 | + "a simple LF here".chr(10). |
|
180 | + "and then LFCR".chr(10).chr(13). |
|
181 | + "last but not least weird names: G".chr(252)."nter, El".chr(232)."ne, and an xml comment closing tag: -->"; |
|
182 | 182 | $m = new xmlrpcmsg('examples.stringecho', array( |
183 | 183 | new xmlrpcval($sendString, 'string'), |
184 | 184 | )); |
@@ -199,7 +199,7 @@ discard block |
||
199 | 199 | public function testLatin1String() |
200 | 200 | { |
201 | 201 | $sendString = |
202 | - "last but not least weird names: G" . chr(252) . "nter, El" . chr(232) . "ne"; |
|
202 | + "last but not least weird names: G".chr(252)."nter, El".chr(232)."ne"; |
|
203 | 203 | $x = '<?xml version="1.0" encoding="ISO-8859-1"?><methodCall><methodName>examples.stringecho</methodName><params><param><value>'. |
204 | 204 | $sendString. |
205 | 205 | '</value></param></params></methodCall>'; |
@@ -303,7 +303,7 @@ discard block |
||
303 | 303 | public function testUtf8Method() |
304 | 304 | { |
305 | 305 | PhpXmlRpc\PhpXmlRpc::$xmlrpc_internalencoding = 'UTF-8'; |
306 | - $m = new xmlrpcmsg("tests.utf8methodname." . 'κόσμε', array( |
|
306 | + $m = new xmlrpcmsg("tests.utf8methodname.".'κόσμε', array( |
|
307 | 307 | new xmlrpcval('hello') |
308 | 308 | )); |
309 | 309 | $v = $this->send($m); |
@@ -325,7 +325,7 @@ discard block |
||
325 | 325 | )); |
326 | 326 | $v = $this->send($m); |
327 | 327 | if ($v) { |
328 | - $this->assertEquals($a + $b, $v->scalarval()); |
|
328 | + $this->assertEquals($a+$b, $v->scalarval()); |
|
329 | 329 | } |
330 | 330 | } |
331 | 331 | |
@@ -337,7 +337,7 @@ discard block |
||
337 | 337 | )); |
338 | 338 | $v = $this->send($m); |
339 | 339 | if ($v) { |
340 | - $this->assertEquals(12 - 23, $v->scalarval()); |
|
340 | + $this->assertEquals(12-23, $v->scalarval()); |
|
341 | 341 | } |
342 | 342 | } |
343 | 343 | |
@@ -371,7 +371,7 @@ discard block |
||
371 | 371 | if ($v) { |
372 | 372 | $sz = $v->arraysize(); |
373 | 373 | $got = ''; |
374 | - for ($i = 0; $i < $sz; $i++) { |
|
374 | + for ($i = 0; $i<$sz; $i++) { |
|
375 | 375 | $b = $v->arraymem($i); |
376 | 376 | if ($b->scalarval()) { |
377 | 377 | $got .= '1'; |
@@ -434,7 +434,7 @@ discard block |
||
434 | 434 | $got = ''; |
435 | 435 | $expected = '37210'; |
436 | 436 | $expect_array = array('ctLeftAngleBrackets', 'ctRightAngleBrackets', 'ctAmpersands', 'ctApostrophes', 'ctQuotes'); |
437 | - foreach($expect_array as $val) { |
|
437 | + foreach ($expect_array as $val) { |
|
438 | 438 | $b = $v->structmem($val); |
439 | 439 | $got .= $b->me['int']; |
440 | 440 | } |
@@ -863,7 +863,7 @@ discard block |
||
863 | 863 | { |
864 | 864 | // make a 'deep client copy' as the original one might have many properties set |
865 | 865 | // also for speed only wrap one method of the whole server |
866 | - $class = wrap_xmlrpc_server($this->client, array('simple_client_copy' => 0, 'method_filter' => '/examples\.getStateName/' )); |
|
866 | + $class = wrap_xmlrpc_server($this->client, array('simple_client_copy' => 0, 'method_filter' => '/examples\.getStateName/')); |
|
867 | 867 | if ($class == '') { |
868 | 868 | $this->fail('Registration of remote server failed'); |
869 | 869 | } else { |
@@ -902,9 +902,9 @@ discard block |
||
902 | 902 | $cookies = array( |
903 | 903 | //'c1' => array(), |
904 | 904 | 'c2' => array('value' => 'c2'), |
905 | - 'c3' => array('value' => 'c3', 'expires' => time() + 60 * 60 * 24 * 30), |
|
906 | - 'c4' => array('value' => 'c4', 'expires' => time() + 60 * 60 * 24 * 30, 'path' => '/'), |
|
907 | - 'c5' => array('value' => 'c5', 'expires' => time() + 60 * 60 * 24 * 30, 'path' => '/', 'domain' => 'localhost'), |
|
905 | + 'c3' => array('value' => 'c3', 'expires' => time()+60 * 60 * 24 * 30), |
|
906 | + 'c4' => array('value' => 'c4', 'expires' => time()+60 * 60 * 24 * 30, 'path' => '/'), |
|
907 | + 'c5' => array('value' => 'c5', 'expires' => time()+60 * 60 * 24 * 30, 'path' => '/', 'domain' => 'localhost'), |
|
908 | 908 | ); |
909 | 909 | $cookiesval = php_xmlrpc_encode($cookies); |
910 | 910 | $m = new xmlrpcmsg('examples.setcookies', array($cookiesval)); |
@@ -952,10 +952,10 @@ discard block |
||
952 | 952 | $m = new xmlrpcmsg('examples.getcookies', array()); |
953 | 953 | foreach ($cookies as $cookie => $val) { |
954 | 954 | $this->client->setCookie($cookie, $val); |
955 | - $cookies[$cookie] = (string)$cookies[$cookie]; |
|
955 | + $cookies[$cookie] = (string) $cookies[$cookie]; |
|
956 | 956 | } |
957 | 957 | $r = $this->client->send($m, $this->timeout, $this->method); |
958 | - $this->assertEquals(0, $r->faultCode(), 'Error ' . $r->faultCode() . ' connecting to server: ' . $r->faultString()); |
|
958 | + $this->assertEquals(0, $r->faultCode(), 'Error '.$r->faultCode().' connecting to server: '.$r->faultString()); |
|
959 | 959 | if (!$r->faultCode()) { |
960 | 960 | $v = $r->value(); |
961 | 961 | $v = php_xmlrpc_decode($v); |
@@ -107,14 +107,16 @@ |
||
107 | 107 | |
108 | 108 | $this->coverageScriptUrl = 'http://' . $this->args['HTTPSERVER'] . '/' . str_replace( '/demo/server/server.php', 'tests/phpunit_coverage.php', $this->args['HTTPURI'] ); |
109 | 109 | |
110 | - if ($this->args['DEBUG'] == 1) |
|
111 | - ob_start(); |
|
110 | + if ($this->args['DEBUG'] == 1) { |
|
111 | + ob_start(); |
|
112 | + } |
|
112 | 113 | } |
113 | 114 | |
114 | 115 | protected function tear_down() |
115 | 116 | { |
116 | - if ($this->args['DEBUG'] != 1) |
|
117 | - return; |
|
117 | + if ($this->args['DEBUG'] != 1) { |
|
118 | + return; |
|
119 | + } |
|
118 | 120 | $out = ob_get_clean(); |
119 | 121 | $status = $this->getStatus(); |
120 | 122 | if ($status == BaseTestRunner::STATUS_ERROR |
@@ -1,10 +1,10 @@ discard block |
||
1 | 1 | <?php |
2 | 2 | |
3 | -include_once __DIR__ . '/../lib/xmlrpc.inc'; |
|
3 | +include_once __DIR__.'/../lib/xmlrpc.inc'; |
|
4 | 4 | |
5 | -include_once __DIR__ . '/parse_args.php'; |
|
5 | +include_once __DIR__.'/parse_args.php'; |
|
6 | 6 | |
7 | -include_once __DIR__ . '/PolyfillTestCase.php'; |
|
7 | +include_once __DIR__.'/PolyfillTestCase.php'; |
|
8 | 8 | |
9 | 9 | use PHPUnit\Runner\BaseTestRunner; |
10 | 10 | |
@@ -59,7 +59,7 @@ discard block |
||
59 | 59 | // make sure there's no freaking catchall DNS in effect |
60 | 60 | $dnsinfo = dns_get_record($this->client->server); |
61 | 61 | if ($dnsinfo) { |
62 | - $this->markTestSkipped('Seems like there is a catchall DNS in effect: host ' . $this->client->server . ' found'); |
|
62 | + $this->markTestSkipped('Seems like there is a catchall DNS in effect: host '.$this->client->server.' found'); |
|
63 | 63 | } else { |
64 | 64 | $this->assertEquals(5, $r->faultCode()); |
65 | 65 | } |
@@ -84,7 +84,7 @@ discard block |
||
84 | 84 | |
85 | 85 | // now test a successful connection |
86 | 86 | $server = explode(':', $this->args['HTTPSERVER']); |
87 | - if (count($server) > 1) { |
|
87 | + if (count($server)>1) { |
|
88 | 88 | $this->client->port = $server[1]; |
89 | 89 | } |
90 | 90 | $this->client->server = $server[0]; |
@@ -24,14 +24,16 @@ |
||
24 | 24 | $this->client = new xmlrpc_client('/NOTEXIST.php', $this->args['HTTPSERVER'], 80); |
25 | 25 | $this->client->setDebug($this->args['DEBUG']); |
26 | 26 | |
27 | - if ($this->args['DEBUG'] == 1) |
|
28 | - ob_start(); |
|
27 | + if ($this->args['DEBUG'] == 1) { |
|
28 | + ob_start(); |
|
29 | + } |
|
29 | 30 | } |
30 | 31 | |
31 | 32 | protected function tear_down() |
32 | 33 | { |
33 | - if ($this->args['DEBUG'] != 1) |
|
34 | - return; |
|
34 | + if ($this->args['DEBUG'] != 1) { |
|
35 | + return; |
|
36 | + } |
|
35 | 37 | $out = ob_get_clean(); |
36 | 38 | $status = $this->getStatus(); |
37 | 39 | if ($status == BaseTestRunner::STATUS_ERROR |
@@ -87,7 +87,7 @@ discard block |
||
87 | 87 | $this->me['struct'] = $val; |
88 | 88 | break; |
89 | 89 | default: |
90 | - Logger::instance()->errorLog("XML-RPC: " . __METHOD__ . ": not a known type ($type)"); |
|
90 | + Logger::instance()->errorLog("XML-RPC: ".__METHOD__.": not a known type ($type)"); |
|
91 | 91 | } |
92 | 92 | } |
93 | 93 | } |
@@ -112,7 +112,7 @@ discard block |
||
112 | 112 | } |
113 | 113 | |
114 | 114 | if ($typeOf !== 1) { |
115 | - Logger::instance()->errorLog("XML-RPC: " . __METHOD__ . ": not a scalar type ($type)"); |
|
115 | + Logger::instance()->errorLog("XML-RPC: ".__METHOD__.": not a scalar type ($type)"); |
|
116 | 116 | return 0; |
117 | 117 | } |
118 | 118 | |
@@ -129,10 +129,10 @@ discard block |
||
129 | 129 | |
130 | 130 | switch ($this->mytype) { |
131 | 131 | case 1: |
132 | - Logger::instance()->errorLog('XML-RPC: ' . __METHOD__ . ': scalar xmlrpc value can have only one value'); |
|
132 | + Logger::instance()->errorLog('XML-RPC: '.__METHOD__.': scalar xmlrpc value can have only one value'); |
|
133 | 133 | return 0; |
134 | 134 | case 3: |
135 | - Logger::instance()->errorLog('XML-RPC: ' . __METHOD__ . ': cannot add anonymous scalar to struct xmlrpc value'); |
|
135 | + Logger::instance()->errorLog('XML-RPC: '.__METHOD__.': cannot add anonymous scalar to struct xmlrpc value'); |
|
136 | 136 | return 0; |
137 | 137 | case 2: |
138 | 138 | // we're adding a scalar value to an array here |
@@ -174,7 +174,7 @@ discard block |
||
174 | 174 | |
175 | 175 | return 1; |
176 | 176 | } else { |
177 | - Logger::instance()->errorLog('XML-RPC: ' . __METHOD__ . ': already initialized as a [' . $this->kindOf() . ']'); |
|
177 | + Logger::instance()->errorLog('XML-RPC: '.__METHOD__.': already initialized as a ['.$this->kindOf().']'); |
|
178 | 178 | return 0; |
179 | 179 | } |
180 | 180 | } |
@@ -205,7 +205,7 @@ discard block |
||
205 | 205 | |
206 | 206 | return 1; |
207 | 207 | } else { |
208 | - Logger::instance()->errorLog('XML-RPC: ' . __METHOD__ . ': already initialized as a [' . $this->kindOf() . ']'); |
|
208 | + Logger::instance()->errorLog('XML-RPC: '.__METHOD__.': already initialized as a ['.$this->kindOf().']'); |
|
209 | 209 | return 0; |
210 | 210 | } |
211 | 211 | } |
@@ -241,19 +241,19 @@ discard block |
||
241 | 241 | case 1: |
242 | 242 | switch ($typ) { |
243 | 243 | case static::$xmlrpcBase64: |
244 | - $rs .= "<${typ}>" . base64_encode($val) . "</${typ}>"; |
|
244 | + $rs .= "<${typ}>".base64_encode($val)."</${typ}>"; |
|
245 | 245 | break; |
246 | 246 | case static::$xmlrpcBoolean: |
247 | - $rs .= "<${typ}>" . ($val ? '1' : '0') . "</${typ}>"; |
|
247 | + $rs .= "<${typ}>".($val ? '1' : '0')."</${typ}>"; |
|
248 | 248 | break; |
249 | 249 | case static::$xmlrpcString: |
250 | 250 | // Do NOT use htmlentities, since it will produce named html entities, which are invalid xml |
251 | - $rs .= "<${typ}>" . Charset::instance()->encodeEntities($val, PhpXmlRpc::$xmlrpc_internalencoding, $charsetEncoding) . "</${typ}>"; |
|
251 | + $rs .= "<${typ}>".Charset::instance()->encodeEntities($val, PhpXmlRpc::$xmlrpc_internalencoding, $charsetEncoding)."</${typ}>"; |
|
252 | 252 | break; |
253 | 253 | case static::$xmlrpcInt: |
254 | 254 | case static::$xmlrpcI4: |
255 | 255 | case static::$xmlrpcI8: |
256 | - $rs .= "<${typ}>" . (int)$val . "</${typ}>"; |
|
256 | + $rs .= "<${typ}>".(int) $val."</${typ}>"; |
|
257 | 257 | break; |
258 | 258 | case static::$xmlrpcDouble: |
259 | 259 | // avoid using standard conversion of float to string because it is locale-dependent, |
@@ -261,15 +261,15 @@ discard block |
||
261 | 261 | // sprintf('%F') could be most likely ok but it fails eg. on 2e-14. |
262 | 262 | // The code below tries its best at keeping max precision while avoiding exp notation, |
263 | 263 | // but there is of course no limit in the number of decimal places to be used... |
264 | - $rs .= "<${typ}>" . preg_replace('/\\.?0+$/', '', number_format((double)$val, PhpXmlRpc::$xmlpc_double_precision, '.', '')) . "</${typ}>"; |
|
264 | + $rs .= "<${typ}>".preg_replace('/\\.?0+$/', '', number_format((double) $val, PhpXmlRpc::$xmlpc_double_precision, '.', ''))."</${typ}>"; |
|
265 | 265 | break; |
266 | 266 | case static::$xmlrpcDateTime: |
267 | 267 | if (is_string($val)) { |
268 | 268 | $rs .= "<${typ}>${val}</${typ}>"; |
269 | 269 | } elseif (is_a($val, 'DateTime')) { |
270 | - $rs .= "<${typ}>" . $val->format('Ymd\TH:i:s') . "</${typ}>"; |
|
270 | + $rs .= "<${typ}>".$val->format('Ymd\TH:i:s')."</${typ}>"; |
|
271 | 271 | } elseif (is_int($val)) { |
272 | - $rs .= "<${typ}>" . strftime("%Y%m%dT%H:%M:%S", $val) . "</${typ}>"; |
|
272 | + $rs .= "<${typ}>".strftime("%Y%m%dT%H:%M:%S", $val)."</${typ}>"; |
|
273 | 273 | } else { |
274 | 274 | // not really a good idea here: but what shall we output anyway? left for backward compat... |
275 | 275 | $rs .= "<${typ}>${val}</${typ}>"; |
@@ -291,14 +291,14 @@ discard block |
||
291 | 291 | case 3: |
292 | 292 | // struct |
293 | 293 | if ($this->_php_class) { |
294 | - $rs .= '<struct php_class="' . $this->_php_class . "\">\n"; |
|
294 | + $rs .= '<struct php_class="'.$this->_php_class."\">\n"; |
|
295 | 295 | } else { |
296 | 296 | $rs .= "<struct>\n"; |
297 | 297 | } |
298 | 298 | $charsetEncoder = Charset::instance(); |
299 | 299 | /** @var Value $val2 */ |
300 | 300 | foreach ($val as $key2 => $val2) { |
301 | - $rs .= '<member><name>' . $charsetEncoder->encodeEntities($key2, PhpXmlRpc::$xmlrpc_internalencoding, $charsetEncoding) . "</name>\n"; |
|
301 | + $rs .= '<member><name>'.$charsetEncoder->encodeEntities($key2, PhpXmlRpc::$xmlrpc_internalencoding, $charsetEncoding)."</name>\n"; |
|
302 | 302 | //$rs.=$this->serializeval($val2); |
303 | 303 | $rs .= $val2->serialize($charsetEncoding); |
304 | 304 | $rs .= "</member>\n"; |
@@ -334,7 +334,7 @@ discard block |
||
334 | 334 | $val = reset($this->me); |
335 | 335 | $typ = key($this->me); |
336 | 336 | |
337 | - return '<value>' . $this->serializedata($typ, $val, $charsetEncoding) . "</value>\n"; |
|
337 | + return '<value>'.$this->serializedata($typ, $val, $charsetEncoding)."</value>\n"; |
|
338 | 338 | } |
339 | 339 | |
340 | 340 | /** |
@@ -46,13 +46,13 @@ discard block |
||
46 | 46 | 'scalar' => $val, |
47 | 47 | 'timestamp' => \PhpXmlRpc\Helper\Date::iso8601Decode($val) |
48 | 48 | ); |
49 | - return (object)$xmlrpcVal; |
|
49 | + return (object) $xmlrpcVal; |
|
50 | 50 | case 'base64': |
51 | 51 | $xmlrpcVal = array( |
52 | 52 | 'xmlrpc_type' => 'base64', |
53 | 53 | 'scalar' => $val |
54 | 54 | ); |
55 | - return (object)$xmlrpcVal; |
|
55 | + return (object) $xmlrpcVal; |
|
56 | 56 | default: |
57 | 57 | return $xmlrpcVal->scalarval(); |
58 | 58 | } |
@@ -77,7 +77,7 @@ discard block |
||
77 | 77 | return $xmlrpcVal->scalarval(); |
78 | 78 | case 'array': |
79 | 79 | $arr = array(); |
80 | - foreach($xmlrpcVal as $value) { |
|
80 | + foreach ($xmlrpcVal as $value) { |
|
81 | 81 | $arr[] = $this->decode($value, $options); |
82 | 82 | } |
83 | 83 | |
@@ -107,7 +107,7 @@ discard block |
||
107 | 107 | case 'msg': |
108 | 108 | $paramCount = $xmlrpcVal->getNumParams(); |
109 | 109 | $arr = array(); |
110 | - for ($i = 0; $i < $paramCount; $i++) { |
|
110 | + for ($i = 0; $i<$paramCount; $i++) { |
|
111 | 111 | $arr[] = $this->decode($xmlrpcVal->getParam($i), $options); |
112 | 112 | } |
113 | 113 | |
@@ -200,7 +200,7 @@ discard block |
||
200 | 200 | |
201 | 201 | } else { |
202 | 202 | $arr = array(); |
203 | - foreach($phpVal as $k => $v) { |
|
203 | + foreach ($phpVal as $k => $v) { |
|
204 | 204 | $arr[$k] = $this->encode($v, $options); |
205 | 205 | } |
206 | 206 | $xmlrpcVal = new Value($arr, Value::$xmlrpcStruct); |
@@ -222,7 +222,7 @@ discard block |
||
222 | 222 | break; |
223 | 223 | case 'resource': |
224 | 224 | if (in_array('extension_api', $options)) { |
225 | - $xmlrpcVal = new Value((int)$phpVal, Value::$xmlrpcInt); |
|
225 | + $xmlrpcVal = new Value((int) $phpVal, Value::$xmlrpcInt); |
|
226 | 226 | } else { |
227 | 227 | $xmlrpcVal = new Value(); |
228 | 228 | } |
@@ -270,7 +270,7 @@ discard block |
||
270 | 270 | if (extension_loaded('mbstring')) { |
271 | 271 | $xmlVal = mb_convert_encoding($xmlVal, 'UTF-8', $valEncoding); |
272 | 272 | } else { |
273 | - Logger::instance()->errorLog('XML-RPC: ' . __METHOD__ . ': invalid charset encoding of xml text: ' . $valEncoding); |
|
273 | + Logger::instance()->errorLog('XML-RPC: '.__METHOD__.': invalid charset encoding of xml text: '.$valEncoding); |
|
274 | 274 | } |
275 | 275 | } |
276 | 276 | } |
@@ -286,7 +286,7 @@ discard block |
||
286 | 286 | $xmlRpcParser = new XMLParser($options); |
287 | 287 | $xmlRpcParser->parse($xmlVal, XMLParser::RETURN_XMLRPCVALS, XMLParser::ACCEPT_REQUEST | XMLParser::ACCEPT_RESPONSE | XMLParser::ACCEPT_VALUE | XMLParser::ACCEPT_FAULT); |
288 | 288 | |
289 | - if ($xmlRpcParser->_xh['isf'] > 1) { |
|
289 | + if ($xmlRpcParser->_xh['isf']>1) { |
|
290 | 290 | // test that $xmlrpc->_xh['value'] is an obj, too??? |
291 | 291 | |
292 | 292 | Logger::instance()->errorLog($xmlRpcParser->_xh['isf_reason']); |
@@ -310,7 +310,7 @@ discard block |
||
310 | 310 | return $r; |
311 | 311 | case 'methodcall': |
312 | 312 | $req = new Request($xmlRpcParser->_xh['method']); |
313 | - for ($i = 0; $i < count($xmlRpcParser->_xh['params']); $i++) { |
|
313 | + for ($i = 0; $i<count($xmlRpcParser->_xh['params']); $i++) { |
|
314 | 314 | $req->addParam($xmlRpcParser->_xh['params'][$i]); |
315 | 315 | } |
316 | 316 |
@@ -59,12 +59,12 @@ discard block |
||
59 | 59 | */ |
60 | 60 | private function __construct() |
61 | 61 | { |
62 | - for ($i = 0; $i < 32; $i++) { |
|
62 | + for ($i = 0; $i<32; $i++) { |
|
63 | 63 | $this->xml_iso88591_Entities["in"][] = chr($i); |
64 | 64 | $this->xml_iso88591_Entities["out"][] = "&#{$i};"; |
65 | 65 | } |
66 | 66 | |
67 | - for ($i = 160; $i < 256; $i++) { |
|
67 | + for ($i = 160; $i<256; $i++) { |
|
68 | 68 | $this->xml_iso88591_Entities["in"][] = chr($i); |
69 | 69 | $this->xml_iso88591_Entities["out"][] = "&#{$i};"; |
70 | 70 | } |
@@ -101,7 +101,7 @@ discard block |
||
101 | 101 | $srcEncoding = PhpXmlRpc::$xmlrpc_internalencoding; |
102 | 102 | } |
103 | 103 | |
104 | - $conversion = strtoupper($srcEncoding . '_' . $destEncoding); |
|
104 | + $conversion = strtoupper($srcEncoding.'_'.$destEncoding); |
|
105 | 105 | switch ($conversion) { |
106 | 106 | case 'ISO-8859-1_': |
107 | 107 | case 'ISO-8859-1_US-ASCII': |
@@ -130,13 +130,13 @@ discard block |
||
130 | 130 | // NB: this will choke on invalid UTF-8, going most likely beyond EOF |
131 | 131 | $escapedData = ''; |
132 | 132 | // be kind to users creating string xmlrpc values out of different php types |
133 | - $data = (string)$data; |
|
133 | + $data = (string) $data; |
|
134 | 134 | $ns = strlen($data); |
135 | - for ($nn = 0; $nn < $ns; $nn++) { |
|
135 | + for ($nn = 0; $nn<$ns; $nn++) { |
|
136 | 136 | $ch = $data[$nn]; |
137 | 137 | $ii = ord($ch); |
138 | 138 | // 7 bits: 0bbbbbbb (127) |
139 | - if ($ii < 128) { |
|
139 | + if ($ii<128) { |
|
140 | 140 | /// @todo shall we replace this with a (supposedly) faster str_replace? |
141 | 141 | switch ($ii) { |
142 | 142 | case 34: |
@@ -160,33 +160,33 @@ discard block |
||
160 | 160 | } // 11 bits: 110bbbbb 10bbbbbb (2047) |
161 | 161 | elseif ($ii >> 5 == 6) { |
162 | 162 | $b1 = ($ii & 31); |
163 | - $ii = ord($data[$nn + 1]); |
|
163 | + $ii = ord($data[$nn+1]); |
|
164 | 164 | $b2 = ($ii & 63); |
165 | - $ii = ($b1 * 64) + $b2; |
|
165 | + $ii = ($b1 * 64)+$b2; |
|
166 | 166 | $ent = sprintf('&#%d;', $ii); |
167 | 167 | $escapedData .= $ent; |
168 | 168 | $nn += 1; |
169 | 169 | } // 16 bits: 1110bbbb 10bbbbbb 10bbbbbb |
170 | 170 | elseif ($ii >> 4 == 14) { |
171 | 171 | $b1 = ($ii & 15); |
172 | - $ii = ord($data[$nn + 1]); |
|
172 | + $ii = ord($data[$nn+1]); |
|
173 | 173 | $b2 = ($ii & 63); |
174 | - $ii = ord($data[$nn + 2]); |
|
174 | + $ii = ord($data[$nn+2]); |
|
175 | 175 | $b3 = ($ii & 63); |
176 | - $ii = ((($b1 * 64) + $b2) * 64) + $b3; |
|
176 | + $ii = ((($b1 * 64)+$b2) * 64)+$b3; |
|
177 | 177 | $ent = sprintf('&#%d;', $ii); |
178 | 178 | $escapedData .= $ent; |
179 | 179 | $nn += 2; |
180 | 180 | } // 21 bits: 11110bbb 10bbbbbb 10bbbbbb 10bbbbbb |
181 | 181 | elseif ($ii >> 3 == 30) { |
182 | 182 | $b1 = ($ii & 7); |
183 | - $ii = ord($data[$nn + 1]); |
|
183 | + $ii = ord($data[$nn+1]); |
|
184 | 184 | $b2 = ($ii & 63); |
185 | - $ii = ord($data[$nn + 2]); |
|
185 | + $ii = ord($data[$nn+2]); |
|
186 | 186 | $b3 = ($ii & 63); |
187 | - $ii = ord($data[$nn + 3]); |
|
187 | + $ii = ord($data[$nn+3]); |
|
188 | 188 | $b4 = ($ii & 63); |
189 | - $ii = ((((($b1 * 64) + $b2) * 64) + $b3) * 64) + $b4; |
|
189 | + $ii = ((((($b1 * 64)+$b2) * 64)+$b3) * 64)+$b4; |
|
190 | 190 | $ent = sprintf('&#%d;', $ii); |
191 | 191 | $escapedData .= $ent; |
192 | 192 | $nn += 3; |
@@ -221,7 +221,7 @@ discard block |
||
221 | 221 | |
222 | 222 | default: |
223 | 223 | $escapedData = ''; |
224 | - Logger::instance()->errorLog('XML-RPC: ' . __METHOD__ . ": Converting from $srcEncoding to $destEncoding: not supported..."); |
|
224 | + Logger::instance()->errorLog('XML-RPC: '.__METHOD__.": Converting from $srcEncoding to $destEncoding: not supported..."); |
|
225 | 225 | } |
226 | 226 | |
227 | 227 | return $escapedData; |
@@ -275,7 +275,7 @@ discard block |
||
275 | 275 | case 'iso88591': |
276 | 276 | return $this->xml_iso88591_Entities; |
277 | 277 | default: |
278 | - throw new \Exception('Unsupported charset: ' . $charset); |
|
278 | + throw new \Exception('Unsupported charset: '.$charset); |
|
279 | 279 | } |
280 | 280 | } |
281 | 281 |
@@ -123,7 +123,7 @@ discard block |
||
123 | 123 | |
124 | 124 | xml_set_object($parser, $this); |
125 | 125 | |
126 | - switch($returnType) { |
|
126 | + switch ($returnType) { |
|
127 | 127 | case self::RETURN_PHP: |
128 | 128 | xml_set_element_handler($parser, 'xmlrpc_se', 'xmlrpc_ee_fast'); |
129 | 129 | break; |
@@ -140,10 +140,10 @@ discard block |
||
140 | 140 | $this->accept = $accept; |
141 | 141 | |
142 | 142 | // @see ticket #70 - we have to parse big xml docks in chunks to avoid errors |
143 | - for ($offset = 0; $offset < $len; $offset += $this->maxChunkLength) { |
|
143 | + for ($offset = 0; $offset<$len; $offset += $this->maxChunkLength) { |
|
144 | 144 | $chunk = substr($data, $offset, $this->maxChunkLength); |
145 | 145 | // error handling: xml not well formed |
146 | - if (!xml_parse($parser, $chunk, $offset + $this->maxChunkLength >= $len)) { |
|
146 | + if (!xml_parse($parser, $chunk, $offset+$this->maxChunkLength>=$len)) { |
|
147 | 147 | $errCode = xml_get_error_code($parser); |
148 | 148 | $errStr = sprintf('XML error %s: %s at line %d, column %d', $errCode, xml_error_string($errCode), |
149 | 149 | xml_get_current_line_number($parser), xml_get_current_column_number($parser)); |
@@ -167,7 +167,7 @@ discard block |
||
167 | 167 | public function xmlrpc_se($parser, $name, $attrs, $acceptSingleVals = false) |
168 | 168 | { |
169 | 169 | // if invalid xmlrpc already detected, skip all processing |
170 | - if ($this->_xh['isf'] < 2) { |
|
170 | + if ($this->_xh['isf']<2) { |
|
171 | 171 | |
172 | 172 | // check for correct element nesting |
173 | 173 | if (count($this->_xh['stack']) == 0) { |
@@ -187,7 +187,7 @@ discard block |
||
187 | 187 | $this->_xh['rt'] = strtolower($name); |
188 | 188 | } else { |
189 | 189 | $this->_xh['isf'] = 2; |
190 | - $this->_xh['isf_reason'] = 'missing top level xmlrpc element. Found: ' . $name; |
|
190 | + $this->_xh['isf_reason'] = 'missing top level xmlrpc element. Found: '.$name; |
|
191 | 191 | |
192 | 192 | return; |
193 | 193 | } |
@@ -281,7 +281,7 @@ discard block |
||
281 | 281 | break; |
282 | 282 | case 'MEMBER': |
283 | 283 | // set member name to null, in case we do not find in the xml later on |
284 | - $this->_xh['valuestack'][count($this->_xh['valuestack']) - 1]['name'] = ''; |
|
284 | + $this->_xh['valuestack'][count($this->_xh['valuestack'])-1]['name'] = ''; |
|
285 | 285 | //$this->_xh['ac']=''; |
286 | 286 | // Drop trough intentionally |
287 | 287 | case 'PARAM': |
@@ -341,7 +341,7 @@ discard block |
||
341 | 341 | */ |
342 | 342 | public function xmlrpc_ee($parser, $name, $rebuildXmlrpcvals = 1) |
343 | 343 | { |
344 | - if ($this->_xh['isf'] < 2) { |
|
344 | + if ($this->_xh['isf']<2) { |
|
345 | 345 | // push this element name from stack |
346 | 346 | // NB: if XML validates, correct opening/closing is guaranteed and |
347 | 347 | // we do not have to check for $name == $currElem. |
@@ -356,7 +356,7 @@ discard block |
||
356 | 356 | $this->_xh['vt'] = Value::$xmlrpcString; |
357 | 357 | } |
358 | 358 | |
359 | - if ($rebuildXmlrpcvals > 0) { |
|
359 | + if ($rebuildXmlrpcvals>0) { |
|
360 | 360 | // build the xmlrpc val out of the data received, and substitute it |
361 | 361 | $temp = new Value($this->_xh['value'], $this->_xh['vt']); |
362 | 362 | // in case we got info about underlying php class, save it |
@@ -365,15 +365,15 @@ discard block |
||
365 | 365 | $temp->_php_class = $this->_xh['php_class']; |
366 | 366 | } |
367 | 367 | $this->_xh['value'] = $temp; |
368 | - } elseif ($rebuildXmlrpcvals < 0) { |
|
368 | + } elseif ($rebuildXmlrpcvals<0) { |
|
369 | 369 | if ($this->_xh['vt'] == Value::$xmlrpcDateTime) { |
370 | - $this->_xh['value'] = (object)array( |
|
370 | + $this->_xh['value'] = (object) array( |
|
371 | 371 | 'xmlrpc_type' => 'datetime', |
372 | 372 | 'scalar' => $this->_xh['value'], |
373 | 373 | 'timestamp' => \PhpXmlRpc\Helper\Date::iso8601Decode($this->_xh['value']) |
374 | 374 | ); |
375 | 375 | } elseif ($this->_xh['vt'] == Value::$xmlrpcBase64) { |
376 | - $this->_xh['value'] = (object)array( |
|
376 | + $this->_xh['value'] = (object) array( |
|
377 | 377 | 'xmlrpc_type' => 'base64', |
378 | 378 | 'scalar' => $this->_xh['value'] |
379 | 379 | ); |
@@ -389,8 +389,8 @@ discard block |
||
389 | 389 | // check if we are inside an array or struct: |
390 | 390 | // if value just built is inside an array, let's move it into array on the stack |
391 | 391 | $vscount = count($this->_xh['valuestack']); |
392 | - if ($vscount && $this->_xh['valuestack'][$vscount - 1]['type'] == 'ARRAY') { |
|
393 | - $this->_xh['valuestack'][$vscount - 1]['values'][] = $this->_xh['value']; |
|
392 | + if ($vscount && $this->_xh['valuestack'][$vscount-1]['type'] == 'ARRAY') { |
|
393 | + $this->_xh['valuestack'][$vscount-1]['values'][] = $this->_xh['value']; |
|
394 | 394 | } |
395 | 395 | break; |
396 | 396 | case 'BOOLEAN': |
@@ -409,7 +409,7 @@ discard block |
||
409 | 409 | $this->_xh['value'] = $this->_xh['ac']; |
410 | 410 | } elseif ($name == 'DATETIME.ISO8601') { |
411 | 411 | if (!preg_match('/^[0-9]{8}T[0-9]{2}:[0-9]{2}:[0-9]{2}$/', $this->_xh['ac'])) { |
412 | - Logger::instance()->errorLog('XML-RPC: ' . __METHOD__ . ': invalid value received in DATETIME: ' . $this->_xh['ac']); |
|
412 | + Logger::instance()->errorLog('XML-RPC: '.__METHOD__.': invalid value received in DATETIME: '.$this->_xh['ac']); |
|
413 | 413 | } |
414 | 414 | $this->_xh['vt'] = Value::$xmlrpcDateTime; |
415 | 415 | $this->_xh['value'] = $this->_xh['ac']; |
@@ -428,7 +428,7 @@ discard block |
||
428 | 428 | } else { |
429 | 429 | // log if receiving something strange, even though we set the value to false anyway |
430 | 430 | if ($this->_xh['ac'] != '0' && strcasecmp($this->_xh['ac'], 'false') != 0) { |
431 | - Logger::instance()->errorLog('XML-RPC: ' . __METHOD__ . ': invalid value received in BOOLEAN: ' . $this->_xh['ac']); |
|
431 | + Logger::instance()->errorLog('XML-RPC: '.__METHOD__.': invalid value received in BOOLEAN: '.$this->_xh['ac']); |
|
432 | 432 | } |
433 | 433 | $this->_xh['value'] = false; |
434 | 434 | } |
@@ -438,37 +438,37 @@ discard block |
||
438 | 438 | // NOTE: regexp could be much stricter than this... |
439 | 439 | if (!preg_match('/^[+-eE0123456789 \t.]+$/', $this->_xh['ac'])) { |
440 | 440 | /// @todo: find a better way of throwing an error than this! |
441 | - Logger::instance()->errorLog('XML-RPC: ' . __METHOD__ . ': non numeric value received in DOUBLE: ' . $this->_xh['ac']); |
|
441 | + Logger::instance()->errorLog('XML-RPC: '.__METHOD__.': non numeric value received in DOUBLE: '.$this->_xh['ac']); |
|
442 | 442 | $this->_xh['value'] = 'ERROR_NON_NUMERIC_FOUND'; |
443 | 443 | } else { |
444 | 444 | // it's ok, add it on |
445 | - $this->_xh['value'] = (double)$this->_xh['ac']; |
|
445 | + $this->_xh['value'] = (double) $this->_xh['ac']; |
|
446 | 446 | } |
447 | 447 | } else { |
448 | 448 | // we have an I4/I8/INT |
449 | 449 | // we must check that only 0123456789-<space> are characters here |
450 | 450 | if (!preg_match('/^[+-]?[0123456789 \t]+$/', $this->_xh['ac'])) { |
451 | 451 | /// @todo find a better way of throwing an error than this! |
452 | - Logger::instance()->errorLog('XML-RPC: ' . __METHOD__ . ': non numeric value received in INT: ' . $this->_xh['ac']); |
|
452 | + Logger::instance()->errorLog('XML-RPC: '.__METHOD__.': non numeric value received in INT: '.$this->_xh['ac']); |
|
453 | 453 | $this->_xh['value'] = 'ERROR_NON_NUMERIC_FOUND'; |
454 | 454 | } else { |
455 | 455 | // it's ok, add it on |
456 | - $this->_xh['value'] = (int)$this->_xh['ac']; |
|
456 | + $this->_xh['value'] = (int) $this->_xh['ac']; |
|
457 | 457 | } |
458 | 458 | } |
459 | 459 | $this->_xh['lv'] = 3; // indicate we've found a value |
460 | 460 | break; |
461 | 461 | case 'NAME': |
462 | - $this->_xh['valuestack'][count($this->_xh['valuestack']) - 1]['name'] = $this->_xh['ac']; |
|
462 | + $this->_xh['valuestack'][count($this->_xh['valuestack'])-1]['name'] = $this->_xh['ac']; |
|
463 | 463 | break; |
464 | 464 | case 'MEMBER': |
465 | 465 | // add to array in the stack the last element built, |
466 | 466 | // unless no VALUE was found |
467 | 467 | if ($this->_xh['vt']) { |
468 | 468 | $vscount = count($this->_xh['valuestack']); |
469 | - $this->_xh['valuestack'][$vscount - 1]['values'][$this->_xh['valuestack'][$vscount - 1]['name']] = $this->_xh['value']; |
|
469 | + $this->_xh['valuestack'][$vscount-1]['values'][$this->_xh['valuestack'][$vscount-1]['name']] = $this->_xh['value']; |
|
470 | 470 | } else { |
471 | - Logger::instance()->errorLog('XML-RPC: ' . __METHOD__ . ': missing VALUE inside STRUCT in received xml'); |
|
471 | + Logger::instance()->errorLog('XML-RPC: '.__METHOD__.': missing VALUE inside STRUCT in received xml'); |
|
472 | 472 | } |
473 | 473 | break; |
474 | 474 | case 'DATA': |
@@ -491,7 +491,7 @@ discard block |
||
491 | 491 | $this->_xh['params'][] = $this->_xh['value']; |
492 | 492 | $this->_xh['pt'][] = $this->_xh['vt']; |
493 | 493 | } else { |
494 | - Logger::instance()->errorLog('XML-RPC: ' . __METHOD__ . ': missing VALUE inside PARAM in received xml'); |
|
494 | + Logger::instance()->errorLog('XML-RPC: '.__METHOD__.': missing VALUE inside PARAM in received xml'); |
|
495 | 495 | } |
496 | 496 | break; |
497 | 497 | case 'METHODNAME': |
@@ -547,7 +547,7 @@ discard block |
||
547 | 547 | public function xmlrpc_cd($parser, $data) |
548 | 548 | { |
549 | 549 | // skip processing if xml fault already detected |
550 | - if ($this->_xh['isf'] < 2) { |
|
550 | + if ($this->_xh['isf']<2) { |
|
551 | 551 | // "lookforvalue==3" means that we've found an entire value |
552 | 552 | // and should discard any further character data |
553 | 553 | if ($this->_xh['lv'] != 3) { |
@@ -565,7 +565,7 @@ discard block |
||
565 | 565 | public function xmlrpc_dh($parser, $data) |
566 | 566 | { |
567 | 567 | // skip processing if xml fault already detected |
568 | - if ($this->_xh['isf'] < 2) { |
|
568 | + if ($this->_xh['isf']<2) { |
|
569 | 569 | if (substr($data, 0, 1) == '&' && substr($data, -1, 1) == ';') { |
570 | 570 | $this->_xh['ac'] .= $data; |
571 | 571 | } |
@@ -636,8 +636,8 @@ discard block |
||
636 | 636 | // Details: |
637 | 637 | // SPACE: (#x20 | #x9 | #xD | #xA)+ === [ \x9\xD\xA]+ |
638 | 638 | // EQ: SPACE?=SPACE? === [ \x9\xD\xA]*=[ \x9\xD\xA]* |
639 | - if (preg_match('/^<\?xml\s+version\s*=\s*' . "((?:\"[a-zA-Z0-9_.:-]+\")|(?:'[a-zA-Z0-9_.:-]+'))" . |
|
640 | - '\s+encoding\s*=\s*' . "((?:\"[A-Za-z][A-Za-z0-9._-]*\")|(?:'[A-Za-z][A-Za-z0-9._-]*'))/", |
|
639 | + if (preg_match('/^<\?xml\s+version\s*=\s*'."((?:\"[a-zA-Z0-9_.:-]+\")|(?:'[a-zA-Z0-9_.:-]+'))". |
|
640 | + '\s+encoding\s*=\s*'."((?:\"[A-Za-z][A-Za-z0-9._-]*\")|(?:'[A-Za-z][A-Za-z0-9._-]*'))/", |
|
641 | 641 | $xmlChunk, $matches)) { |
642 | 642 | return strtoupper(substr($matches[2], 1, -1)); |
643 | 643 | } |
@@ -655,7 +655,7 @@ discard block |
||
655 | 655 | // NB: mb_detect likes to call it ascii, xml parser likes to call it US_ASCII... |
656 | 656 | // IANA also likes better US-ASCII, so go with it |
657 | 657 | if ($enc == 'ASCII') { |
658 | - $enc = 'US-' . $enc; |
|
658 | + $enc = 'US-'.$enc; |
|
659 | 659 | } |
660 | 660 | |
661 | 661 | return $enc; |
@@ -690,8 +690,8 @@ discard block |
||
690 | 690 | // Details: |
691 | 691 | // SPACE: (#x20 | #x9 | #xD | #xA)+ === [ \x9\xD\xA]+ |
692 | 692 | // EQ: SPACE?=SPACE? === [ \x9\xD\xA]*=[ \x9\xD\xA]* |
693 | - if (preg_match('/^<\?xml\s+version\s*=\s*' . "((?:\"[a-zA-Z0-9_.:-]+\")|(?:'[a-zA-Z0-9_.:-]+'))" . |
|
694 | - '\s+encoding\s*=\s*' . "((?:\"[A-Za-z][A-Za-z0-9._-]*\")|(?:'[A-Za-z][A-Za-z0-9._-]*'))/", |
|
693 | + if (preg_match('/^<\?xml\s+version\s*=\s*'."((?:\"[a-zA-Z0-9_.:-]+\")|(?:'[a-zA-Z0-9_.:-]+'))". |
|
694 | + '\s+encoding\s*=\s*'."((?:\"[A-Za-z][A-Za-z0-9._-]*\")|(?:'[A-Za-z][A-Za-z0-9._-]*'))/", |
|
695 | 695 | $xmlChunk, $matches)) { |
696 | 696 | return true; |
697 | 697 | } |