@@ -1,8 +1,8 @@ discard block |
||
1 | 1 | <?php |
2 | 2 | |
3 | -include_once __DIR__ . '/../lib/xmlrpc_wrappers.inc'; |
|
3 | +include_once __DIR__.'/../lib/xmlrpc_wrappers.inc'; |
|
4 | 4 | |
5 | -include_once __DIR__ . '/ServerAwareTestCase.php'; |
|
5 | +include_once __DIR__.'/ServerAwareTestCase.php'; |
|
6 | 6 | |
7 | 7 | /** |
8 | 8 | * Tests which involve interaction with the server - carried out via the client. |
@@ -30,7 +30,7 @@ discard block |
||
30 | 30 | // (but only if not called from subclass objects / multitests) |
31 | 31 | if (function_exists('debug_backtrace') && strtolower(get_called_class()) == 'servertest') { |
32 | 32 | $trace = debug_backtrace(DEBUG_BACKTRACE_IGNORE_ARGS); |
33 | - for ($i = 0; $i < count($trace); $i++) { |
|
33 | + for ($i = 0; $i<count($trace); $i++) { |
|
34 | 34 | if (strpos($trace[$i]['function'], 'test') === 0) { |
35 | 35 | self::$failed_tests[$trace[$i]['function']] = true; |
36 | 36 | break; |
@@ -79,9 +79,9 @@ discard block |
||
79 | 79 | } |
80 | 80 | $this->validateResponse($r); |
81 | 81 | if (is_array($errorCode)) { |
82 | - $this->assertContains($r->faultCode(), $errorCode, 'Error ' . $r->faultCode() . ' connecting to server: ' . $r->faultString()); |
|
82 | + $this->assertContains($r->faultCode(), $errorCode, 'Error '.$r->faultCode().' connecting to server: '.$r->faultString()); |
|
83 | 83 | } else { |
84 | - $this->assertEquals($errorCode, $r->faultCode(), 'Error ' . $r->faultCode() . ' connecting to server: ' . $r->faultString()); |
|
84 | + $this->assertEquals($errorCode, $r->faultCode(), 'Error '.$r->faultCode().' connecting to server: '.$r->faultString()); |
|
85 | 85 | } |
86 | 86 | if (!$r->faultCode()) { |
87 | 87 | if ($returnResponse) { |
@@ -108,20 +108,20 @@ discard block |
||
108 | 108 | $query = parse_url($this->client->path, PHP_URL_QUERY); |
109 | 109 | parse_str($query, $vars); |
110 | 110 | $query = http_build_query(array_merge($vars, $data)); |
111 | - $this->client->path = parse_url($this->client->path, PHP_URL_PATH) . '?' . $query; |
|
111 | + $this->client->path = parse_url($this->client->path, PHP_URL_PATH).'?'.$query; |
|
112 | 112 | } |
113 | 113 | |
114 | 114 | public function testString() |
115 | 115 | { |
116 | - $sendString = "here are 3 \"entities\": < > & " . |
|
117 | - "and here's a dollar sign: \$pretendvarname and a backslash too: " . chr(92) . |
|
118 | - " - isn't that great? \\\"hackery\\\" at it's best " . |
|
119 | - " also don't want to miss out on \$item[0]. " . |
|
120 | - "The real weird stuff follows: CRLF here" . chr(13) . chr(10) . |
|
121 | - "a simple CR here" . chr(13) . |
|
122 | - "a simple LF here" . chr(10) . |
|
123 | - "and then LFCR" . chr(10) . chr(13) . |
|
124 | - "last but not least weird names: G" . chr(252) . "nter, El" . chr(232) . "ne, and an xml comment closing tag: -->"; |
|
116 | + $sendString = "here are 3 \"entities\": < > & ". |
|
117 | + "and here's a dollar sign: \$pretendvarname and a backslash too: ".chr(92). |
|
118 | + " - isn't that great? \\\"hackery\\\" at it's best ". |
|
119 | + " also don't want to miss out on \$item[0]. ". |
|
120 | + "The real weird stuff follows: CRLF here".chr(13).chr(10). |
|
121 | + "a simple CR here".chr(13). |
|
122 | + "a simple LF here".chr(10). |
|
123 | + "and then LFCR".chr(10).chr(13). |
|
124 | + "last but not least weird names: G".chr(252)."nter, El".chr(232)."ne, and an xml comment closing tag: -->"; |
|
125 | 125 | $m = new xmlrpcmsg('examples.stringecho', array( |
126 | 126 | new xmlrpcval($sendString, 'string'), |
127 | 127 | )); |
@@ -142,7 +142,7 @@ discard block |
||
142 | 142 | public function testLatin1String() |
143 | 143 | { |
144 | 144 | $sendString = |
145 | - "last but not least weird names: G" . chr(252) . "nter, El" . chr(232) . "ne"; |
|
145 | + "last but not least weird names: G".chr(252)."nter, El".chr(232)."ne"; |
|
146 | 146 | $x = '<?xml version="1.0" encoding="ISO-8859-1"?><methodCall><methodName>examples.stringecho</methodName><params><param><value>'. |
147 | 147 | $sendString. |
148 | 148 | '</value></param></params></methodCall>'; |
@@ -251,7 +251,7 @@ discard block |
||
251 | 251 | public function testUtf8Method() |
252 | 252 | { |
253 | 253 | PhpXmlRpc\PhpXmlRpc::$xmlrpc_internalencoding = 'UTF-8'; |
254 | - $m = new xmlrpcmsg("tests.utf8methodname." . 'κόσμε', array( |
|
254 | + $m = new xmlrpcmsg("tests.utf8methodname.".'κόσμε', array( |
|
255 | 255 | new xmlrpcval('hello') |
256 | 256 | )); |
257 | 257 | $v = $this->send($m); |
@@ -272,7 +272,7 @@ discard block |
||
272 | 272 | )); |
273 | 273 | $v = $this->send($m); |
274 | 274 | if ($v) { |
275 | - $this->assertEquals($a + $b, $v->scalarval()); |
|
275 | + $this->assertEquals($a+$b, $v->scalarval()); |
|
276 | 276 | } |
277 | 277 | } |
278 | 278 | |
@@ -284,7 +284,7 @@ discard block |
||
284 | 284 | )); |
285 | 285 | $v = $this->send($m); |
286 | 286 | if ($v) { |
287 | - $this->assertEquals(12 - 23, $v->scalarval()); |
|
287 | + $this->assertEquals(12-23, $v->scalarval()); |
|
288 | 288 | } |
289 | 289 | } |
290 | 290 | |
@@ -323,7 +323,7 @@ discard block |
||
323 | 323 | if ($v) { |
324 | 324 | $sz = $v->arraysize(); |
325 | 325 | $got = ''; |
326 | - for ($i = 0; $i < $sz; $i++) { |
|
326 | + for ($i = 0; $i<$sz; $i++) { |
|
327 | 327 | $b = $v->arraymem($i); |
328 | 328 | if ($b->scalarval()) { |
329 | 329 | $got .= '1'; |
@@ -370,7 +370,7 @@ discard block |
||
370 | 370 | $got = ''; |
371 | 371 | $expected = '37210'; |
372 | 372 | $expect_array = array('ctLeftAngleBrackets', 'ctRightAngleBrackets', 'ctAmpersands', 'ctApostrophes', 'ctQuotes'); |
373 | - foreach($expect_array as $val) { |
|
373 | + foreach ($expect_array as $val) { |
|
374 | 374 | $b = $v->structmem($val); |
375 | 375 | $got .= $b->scalarVal(); |
376 | 376 | } |
@@ -873,7 +873,7 @@ discard block |
||
873 | 873 | { |
874 | 874 | // make a 'deep client copy' as the original one might have many properties set |
875 | 875 | // also for speed only wrap one method of the whole server |
876 | - $class = wrap_xmlrpc_server($this->client, array('simple_client_copy' => 0, 'method_filter' => '/examples\.getStateName/' )); |
|
876 | + $class = wrap_xmlrpc_server($this->client, array('simple_client_copy' => 0, 'method_filter' => '/examples\.getStateName/')); |
|
877 | 877 | if ($class == '') { |
878 | 878 | $this->fail('Registration of remote server failed'); |
879 | 879 | } else { |
@@ -912,9 +912,9 @@ discard block |
||
912 | 912 | $cookies = array( |
913 | 913 | //'c1' => array(), |
914 | 914 | 'c2' => array('value' => 'c2'), |
915 | - 'c3' => array('value' => 'c3', 'expires' => time() + 60 * 60 * 24 * 30), |
|
916 | - 'c4' => array('value' => 'c4', 'expires' => time() + 60 * 60 * 24 * 30, 'path' => '/'), |
|
917 | - 'c5' => array('value' => 'c5', 'expires' => time() + 60 * 60 * 24 * 30, 'path' => '/', 'domain' => 'localhost'), |
|
915 | + 'c3' => array('value' => 'c3', 'expires' => time()+60 * 60 * 24 * 30), |
|
916 | + 'c4' => array('value' => 'c4', 'expires' => time()+60 * 60 * 24 * 30, 'path' => '/'), |
|
917 | + 'c5' => array('value' => 'c5', 'expires' => time()+60 * 60 * 24 * 30, 'path' => '/', 'domain' => 'localhost'), |
|
918 | 918 | ); |
919 | 919 | $cookiesval = php_xmlrpc_encode($cookies); |
920 | 920 | $m = new xmlrpcmsg('tests.setcookies', array($cookiesval)); |
@@ -962,10 +962,10 @@ discard block |
||
962 | 962 | $m = new xmlrpcmsg('tests.getcookies', array()); |
963 | 963 | foreach ($cookies as $cookie => $val) { |
964 | 964 | $this->client->setCookie($cookie, $val); |
965 | - $cookies[$cookie] = (string)$cookies[$cookie]; |
|
965 | + $cookies[$cookie] = (string) $cookies[$cookie]; |
|
966 | 966 | } |
967 | 967 | $r = $this->client->send($m, $this->timeout, $this->method); |
968 | - $this->assertEquals(0, $r->faultCode(), 'Error ' . $r->faultCode() . ' connecting to server: ' . $r->faultString()); |
|
968 | + $this->assertEquals(0, $r->faultCode(), 'Error '.$r->faultCode().' connecting to server: '.$r->faultString()); |
|
969 | 969 | if (!$r->faultCode()) { |
970 | 970 | $v = $r->value(); |
971 | 971 | $v = php_xmlrpc_decode($v); |
@@ -7,7 +7,7 @@ discard block |
||
7 | 7 | // In case this file is made available on an open-access server, avoid it being useable by anyone who can not also |
8 | 8 | // write a specific file to disk. |
9 | 9 | // NB: keep filename, cookie name in sync with the code within the TestCase classes sending http requests to this file |
10 | -$idFile = sys_get_temp_dir() . '/phpunit_rand_id.txt'; |
|
10 | +$idFile = sys_get_temp_dir().'/phpunit_rand_id.txt'; |
|
11 | 11 | $randId = isset($_COOKIE['PHPUNIT_RANDOM_TEST_ID']) ? $_COOKIE['PHPUNIT_RANDOM_TEST_ID'] : ''; |
12 | 12 | $fileId = file_exists($idFile) ? file_get_contents($idFile) : ''; |
13 | 13 | if ($randId == '' || $fileId == '' || $fileId !== $randId) { |
@@ -31,7 +31,7 @@ discard block |
||
31 | 31 | chmod($GLOBALS['PHPUNIT_COVERAGE_DATA_DIRECTORY'], 0777); |
32 | 32 | } |
33 | 33 | |
34 | - include_once __DIR__ . "/../vendor/phpunit/phpunit-selenium/PHPUnit/Extensions/SeleniumCommon/prepend.php"; |
|
34 | + include_once __DIR__."/../vendor/phpunit/phpunit-selenium/PHPUnit/Extensions/SeleniumCommon/prepend.php"; |
|
35 | 35 | } |
36 | 36 | |
37 | 37 | $targetFile = null; |
@@ -54,7 +54,7 @@ discard block |
||
54 | 54 | } |
55 | 55 | |
56 | 56 | if (isset($_COOKIE['PHPUNIT_SELENIUM_TEST_ID']) && extension_loaded('xdebug')) { |
57 | - include_once __DIR__ . "/../vendor/phpunit/phpunit-selenium/PHPUnit/Extensions/SeleniumCommon/append.php"; |
|
57 | + include_once __DIR__."/../vendor/phpunit/phpunit-selenium/PHPUnit/Extensions/SeleniumCommon/append.php"; |
|
58 | 58 | } |
59 | 59 | |
60 | 60 | /** |
@@ -87,7 +87,7 @@ discard block |
||
87 | 87 | } elseif ($_GET['FORCE_AUTH'] == 'Digest') { |
88 | 88 | if (empty($_SERVER['PHP_AUTH_DIGEST'])) { |
89 | 89 | header('HTTP/1.1 401 Unauthorized'); |
90 | - header('WWW-Authenticate: Digest realm="Phpxmlrpc Digest Realm",qop="auth",nonce="' . uniqid() . '",opaque="' . md5('Phpxmlrpc Digest Realm') . '"'); |
|
90 | + header('WWW-Authenticate: Digest realm="Phpxmlrpc Digest Realm",qop="auth",nonce="'.uniqid().'",opaque="'.md5('Phpxmlrpc Digest Realm').'"'); |
|
91 | 91 | die('Text visible if user hits Cancel button'); |
92 | 92 | } |
93 | 93 | } |
@@ -95,11 +95,11 @@ discard block |
||
95 | 95 | if (isset($_GET['FORCE_REDIRECT'])) { |
96 | 96 | header('HTTP/1.0 302 Found'); |
97 | 97 | unset($_GET['FORCE_REDIRECT']); |
98 | - header('Location: ' . $_SERVER['REQUEST_URI'] . (count($_GET) ? '?' . http_build_query($_GET) : '')); |
|
98 | + header('Location: '.$_SERVER['REQUEST_URI'].(count($_GET) ? '?'.http_build_query($_GET) : '')); |
|
99 | 99 | die(); |
100 | 100 | } |
101 | - if (isset($_GET['SLOW_LORIS']) && $_GET['SLOW_LORIS'] > 0) { |
|
102 | - slowLoris((int)$_GET['SLOW_LORIS'], $s); |
|
101 | + if (isset($_GET['SLOW_LORIS']) && $_GET['SLOW_LORIS']>0) { |
|
102 | + slowLoris((int) $_GET['SLOW_LORIS'], $s); |
|
103 | 103 | die(); |
104 | 104 | } |
105 | 105 | } |
@@ -113,13 +113,13 @@ discard block |
||
113 | 113 | { |
114 | 114 | /// @todo as is, this method can not be used by eg. jsonrpc servers. We could look at the value $s::$responseClass |
115 | 115 | /// to improve that |
116 | - $strings = array('<?xml version="1.0"?>','<methodResponse>','<params>','<param>','<value>','<string></string>','</value>','</param>','</params>','</methodResponse>'); |
|
116 | + $strings = array('<?xml version="1.0"?>', '<methodResponse>', '<params>', '<param>', '<value>', '<string></string>', '</value>', '</param>', '</params>', '</methodResponse>'); |
|
117 | 117 | |
118 | 118 | header('Content-type: xml; charset=utf-8'); |
119 | - foreach($strings as $i => $string) { |
|
119 | + foreach ($strings as $i => $string) { |
|
120 | 120 | echo $string; |
121 | 121 | flush(); |
122 | - if ($i < count($strings) && $secs > 0 && $secs <= 60) { |
|
122 | + if ($i<count($strings) && $secs>0 && $secs<=60) { |
|
123 | 123 | sleep($secs); |
124 | 124 | } |
125 | 125 | } |
@@ -1,6 +1,6 @@ discard block |
||
1 | 1 | <?php |
2 | 2 | |
3 | -include_once __DIR__ . '/LoggerAwareTestCase.php'; |
|
3 | +include_once __DIR__.'/LoggerAwareTestCase.php'; |
|
4 | 4 | |
5 | 5 | /** |
6 | 6 | * Tests involving the Value class. |
@@ -138,7 +138,7 @@ discard block |
||
138 | 138 | if (version_compare(PHP_VERSION, '8.0', '>=')) { |
139 | 139 | $str = sprintf("%f", $v->scalarval()); |
140 | 140 | } else { |
141 | - $str = (string)$v->scalarval(); |
|
141 | + $str = (string) $v->scalarval(); |
|
142 | 142 | } |
143 | 143 | if (strpos($str, ',') == 1) { |
144 | 144 | $r = $v->serialize(); |
@@ -159,7 +159,7 @@ discard block |
||
159 | 159 | $this->assertequals(1, count($v1)); |
160 | 160 | $out = array('me' => array(), 'mytype' => 2, '_php_class' => null); |
161 | 161 | |
162 | - foreach($v1 as $key => $val) |
|
162 | + foreach ($v1 as $key => $val) |
|
163 | 163 | { |
164 | 164 | $this->assertArrayHasKey($key, $out); |
165 | 165 | $expected = $out[$key]; |
@@ -174,7 +174,7 @@ discard block |
||
174 | 174 | $this->assertequals(2, count($v2)); |
175 | 175 | $out = array(array('key' => 0, 'value' => 'object'), array('key' => 1, 'value' => 'object')); |
176 | 176 | $i = 0; |
177 | - foreach($v2 as $key => $val) |
|
177 | + foreach ($v2 as $key => $val) |
|
178 | 178 | { |
179 | 179 | $expected = $out[$i]; |
180 | 180 | $this->assertequals($expected['key'], $key); |
@@ -201,7 +201,7 @@ discard block |
||
201 | 201 | { |
202 | 202 | // nb: make sure that the serialized xml corresponding to this is > 10MB in size |
203 | 203 | $data = array(); |
204 | - for ($i = 0; $i < 500000; $i++ ) { |
|
204 | + for ($i = 0; $i<500000; $i++) { |
|
205 | 205 | $data[] = 'hello world'; |
206 | 206 | } |
207 | 207 |
@@ -6,15 +6,15 @@ discard block |
||
6 | 6 | |
7 | 7 | echo "Legacy Loader Test\n\n"; |
8 | 8 | |
9 | -include_once __DIR__ . '/../lib/xmlrpc.inc'; |
|
9 | +include_once __DIR__.'/../lib/xmlrpc.inc'; |
|
10 | 10 | |
11 | -include_once __DIR__ . '/parse_args.php'; |
|
11 | +include_once __DIR__.'/parse_args.php'; |
|
12 | 12 | |
13 | 13 | $args = argParser::getArgs(); |
14 | -$baseurl = 'http://' . $args['HTTPSERVER'] . str_replace('/server.php', '/legacy.php', $args['HTTPURI']); |
|
14 | +$baseurl = 'http://'.$args['HTTPSERVER'].str_replace('/server.php', '/legacy.php', $args['HTTPURI']); |
|
15 | 15 | |
16 | 16 | $randId = uniqid(); |
17 | -file_put_contents(sys_get_temp_dir() . '/phpunit_rand_id.txt', $randId); |
|
17 | +file_put_contents(sys_get_temp_dir().'/phpunit_rand_id.txt', $randId); |
|
18 | 18 | |
19 | 19 | $client = new xmlrpc_client($baseurl); |
20 | 20 | $client->setCookie('PHPUNIT_RANDOM_TEST_ID', $randId); |
@@ -22,11 +22,11 @@ discard block |
||
22 | 22 | $req = new xmlrpcmsg('system.listMethods', array()); |
23 | 23 | $resp = $client->send($req); |
24 | 24 | if ($resp->faultCode() !== 0) { |
25 | - unlink(sys_get_temp_dir() . '/phpunit_rand_id.txt'); |
|
26 | - throw new \Exception("system.listMethods returned fault " . $resp->faultCode()); |
|
25 | + unlink(sys_get_temp_dir().'/phpunit_rand_id.txt'); |
|
26 | + throw new \Exception("system.listMethods returned fault ".$resp->faultCode()); |
|
27 | 27 | } |
28 | 28 | echo ". 1/1 (100%)\n\n"; |
29 | 29 | |
30 | 30 | echo "OK (1 test, 1 assertion)\n"; |
31 | 31 | |
32 | -unlink(sys_get_temp_dir() . '/phpunit_rand_id.txt'); |
|
32 | +unlink(sys_get_temp_dir().'/phpunit_rand_id.txt'); |
@@ -1,6 +1,6 @@ discard block |
||
1 | 1 | <?php |
2 | 2 | |
3 | -include_once __DIR__ . '/08ServerTest.php'; |
|
3 | +include_once __DIR__.'/08ServerTest.php'; |
|
4 | 4 | |
5 | 5 | /** |
6 | 6 | * Tests which stress http features of the library. |
@@ -28,7 +28,7 @@ discard block |
||
28 | 28 | { |
29 | 29 | $methods = array(); |
30 | 30 | // as long as we are descendants, get_class_methods will list private/protected methods |
31 | - foreach(get_class_methods('ServerTest') as $method) |
|
31 | + foreach (get_class_methods('ServerTest') as $method) |
|
32 | 32 | { |
33 | 33 | if (strpos($method, 'test') === 0 && !in_array($method, $this->unsafeMethods)) |
34 | 34 | { |
@@ -296,7 +296,7 @@ discard block |
||
296 | 296 | if (version_compare(PHP_VERSION, '8.0', '>=') && $this->args['SSLVERSION'] == 0) |
297 | 297 | { |
298 | 298 | $version = explode('.', PHP_VERSION); |
299 | - $this->client->setSSLVersion(min(4 + $version[1], 7)); |
|
299 | + $this->client->setSSLVersion(min(4+$version[1], 7)); |
|
300 | 300 | } |
301 | 301 | |
302 | 302 | $this->$method(); |
@@ -328,7 +328,7 @@ discard block |
||
328 | 328 | preg_match('/ubunutu([0-9]+)/', $output[0], $matches); |
329 | 329 | $ubuntuVersion = @$matches[1]; |
330 | 330 | } |
331 | - if ($ubuntuVersion >= 20) { |
|
331 | + if ($ubuntuVersion>=20) { |
|
332 | 332 | $this->markTestSkipped('HTTPS via Socket known to fail on php less than 7.2 on Ubuntu 20 and higher'); |
333 | 333 | return; |
334 | 334 | } |
@@ -349,12 +349,12 @@ discard block |
||
349 | 349 | $version = explode('.', PHP_VERSION); |
350 | 350 | /// @see https://docs.openssl.org/1.1.1/man3/SSL_CTX_set_security_level/#default-callback-behaviour for levels |
351 | 351 | $this->client->setOption(\PhpXmlRpc\Client::OPT_EXTRA_SOCKET_OPTS, |
352 | - array('ssl' => array('security_level' => min(2 + $version[1], 5)))); |
|
352 | + array('ssl' => array('security_level' => min(2+$version[1], 5)))); |
|
353 | 353 | /// @todo we should probably look deeper into the Apache config / ssl version in use to find out why this |
354 | 354 | /// does not work well with TLS < 1.2. |
355 | 355 | /// Also: push this IF to the test matrix config, leave here only setting of security_level |
356 | 356 | if ($this->args['SSLVERSION'] == 0) { |
357 | - $this->client->setSSLVersion(min(5 + $version[1], 7)); |
|
357 | + $this->client->setSSLVersion(min(5+$version[1], 7)); |
|
358 | 358 | } |
359 | 359 | } |
360 | 360 | $this->$method(); |
@@ -394,7 +394,7 @@ discard block |
||
394 | 394 | if (version_compare(PHP_VERSION, '8.0', '>=') && $this->args['SSLVERSION'] == 0) |
395 | 395 | { |
396 | 396 | $version = explode('.', PHP_VERSION); |
397 | - $this->client->setSSLVersion(min(4 + $version[1], 7)); |
|
397 | + $this->client->setSSLVersion(min(4+$version[1], 7)); |
|
398 | 398 | } |
399 | 399 | |
400 | 400 | $this->$method(); |
@@ -554,7 +554,7 @@ discard block |
||
554 | 554 | // this checks for a non-failed call |
555 | 555 | $time = microtime(true); |
556 | 556 | $this->send($m); |
557 | - $time = microtime(true) - $time; |
|
557 | + $time = microtime(true)-$time; |
|
558 | 558 | $this->assertGreaterThan(1.0, $time); |
559 | 559 | $this->assertLessThan(2.0, $time); |
560 | 560 | |
@@ -562,7 +562,7 @@ discard block |
||
562 | 562 | $m = new xmlrpcmsg('tests.sleep', array(new xmlrpcval(5, 'int'))); |
563 | 563 | $time = microtime(true); |
564 | 564 | $r = $this->send($m, array(0, PhpXmlRpc\PhpXmlRpc::$xmlrpcerr['http_error'], PhpXmlRpc\PhpXmlRpc::$xmlrpcerr['curl_fail'])); |
565 | - $time = microtime(true) - $time; |
|
565 | + $time = microtime(true)-$time; |
|
566 | 566 | $this->assertGreaterThan(2.0, $time); |
567 | 567 | $this->assertLessThan(4.0, $time); |
568 | 568 | |
@@ -582,7 +582,7 @@ discard block |
||
582 | 582 | $this->addQueryParams(array('SLOW_LORIS' => 1)); |
583 | 583 | $time = microtime(true); |
584 | 584 | $this->send($m, array(0, PhpXmlRpc\PhpXmlRpc::$xmlrpcerr['http_error'], PhpXmlRpc\PhpXmlRpc::$xmlrpcerr['curl_fail'])); |
585 | - $time = microtime(true) - $time; |
|
585 | + $time = microtime(true)-$time; |
|
586 | 586 | $this->assertGreaterThan(2.0, $time); |
587 | 587 | $this->assertLessThan(4.0, $time); |
588 | 588 | } |
@@ -337,10 +337,10 @@ discard block |
||
337 | 337 | $server = $parts['host']; |
338 | 338 | $path = isset($parts['path']) ? $parts['path'] : ''; |
339 | 339 | if (isset($parts['query'])) { |
340 | - $path .= '?' . $parts['query']; |
|
340 | + $path .= '?'.$parts['query']; |
|
341 | 341 | } |
342 | 342 | if (isset($parts['fragment'])) { |
343 | - $path .= '#' . $parts['fragment']; |
|
343 | + $path .= '#'.$parts['fragment']; |
|
344 | 344 | } |
345 | 345 | if (isset($parts['port'])) { |
346 | 346 | $port = $parts['port']; |
@@ -356,7 +356,7 @@ discard block |
||
356 | 356 | } |
357 | 357 | } |
358 | 358 | if ($path == '' || $path[0] != '/') { |
359 | - $this->path = '/' . $path; |
|
359 | + $this->path = '/'.$path; |
|
360 | 360 | } else { |
361 | 361 | $this->path = $path; |
362 | 362 | } |
@@ -388,7 +388,7 @@ discard block |
||
388 | 388 | //$this->accepted_charset_encodings = $ch->knownCharsets(); |
389 | 389 | |
390 | 390 | // initialize user_agent string |
391 | - $this->user_agent = PhpXmlRpc::$xmlrpcName . ' ' . PhpXmlRpc::$xmlrpcVersion; |
|
391 | + $this->user_agent = PhpXmlRpc::$xmlrpcName.' '.PhpXmlRpc::$xmlrpcVersion; |
|
392 | 392 | } |
393 | 393 | |
394 | 394 | /** |
@@ -560,7 +560,7 @@ discard block |
||
560 | 560 | */ |
561 | 561 | public function setSSLVerifyPeer($i) |
562 | 562 | { |
563 | - $this->logDeprecation('Method ' . __METHOD__ . ' is deprecated'); |
|
563 | + $this->logDeprecation('Method '.__METHOD__.' is deprecated'); |
|
564 | 564 | |
565 | 565 | $this->verifypeer = $i; |
566 | 566 | return $this; |
@@ -577,7 +577,7 @@ discard block |
||
577 | 577 | */ |
578 | 578 | public function setSSLVerifyHost($i) |
579 | 579 | { |
580 | - $this->logDeprecation('Method ' . __METHOD__ . ' is deprecated'); |
|
580 | + $this->logDeprecation('Method '.__METHOD__.' is deprecated'); |
|
581 | 581 | |
582 | 582 | $this->verifyhost = $i; |
583 | 583 | return $this; |
@@ -593,7 +593,7 @@ discard block |
||
593 | 593 | */ |
594 | 594 | public function setSSLVersion($i) |
595 | 595 | { |
596 | - $this->logDeprecation('Method ' . __METHOD__ . ' is deprecated'); |
|
596 | + $this->logDeprecation('Method '.__METHOD__.' is deprecated'); |
|
597 | 597 | |
598 | 598 | $this->sslversion = $i; |
599 | 599 | return $this; |
@@ -658,7 +658,7 @@ discard block |
||
658 | 658 | */ |
659 | 659 | public function setRequestCompression($compMethod) |
660 | 660 | { |
661 | - $this->logDeprecation('Method ' . __METHOD__ . ' is deprecated'); |
|
661 | + $this->logDeprecation('Method '.__METHOD__.' is deprecated'); |
|
662 | 662 | |
663 | 663 | $this->request_compression = $compMethod; |
664 | 664 | return $this; |
@@ -708,7 +708,7 @@ discard block |
||
708 | 708 | */ |
709 | 709 | public function setCurlOptions($options) |
710 | 710 | { |
711 | - $this->logDeprecation('Method ' . __METHOD__ . ' is deprecated'); |
|
711 | + $this->logDeprecation('Method '.__METHOD__.' is deprecated'); |
|
712 | 712 | |
713 | 713 | $this->extracurlopts = $options; |
714 | 714 | return $this; |
@@ -721,7 +721,7 @@ discard block |
||
721 | 721 | */ |
722 | 722 | public function setUseCurl($useCurlMode) |
723 | 723 | { |
724 | - $this->logDeprecation('Method ' . __METHOD__ . ' is deprecated'); |
|
724 | + $this->logDeprecation('Method '.__METHOD__.' is deprecated'); |
|
725 | 725 | |
726 | 726 | $this->use_curl = $useCurlMode; |
727 | 727 | return $this; |
@@ -739,7 +739,7 @@ discard block |
||
739 | 739 | */ |
740 | 740 | public function setUserAgent($agentString) |
741 | 741 | { |
742 | - $this->logDeprecation('Method ' . __METHOD__ . ' is deprecated'); |
|
742 | + $this->logDeprecation('Method '.__METHOD__.' is deprecated'); |
|
743 | 743 | |
744 | 744 | $this->user_agent = $agentString; |
745 | 745 | return $this; |
@@ -770,12 +770,12 @@ discard block |
||
770 | 770 | } |
771 | 771 | } |
772 | 772 | |
773 | - $url = $this->method . '://' . $this->server; |
|
773 | + $url = $this->method.'://'.$this->server; |
|
774 | 774 | if ($this->port == 0 || ($this->port == 80 && in_array($this->method, array('http', 'http10', 'http11', 'h2c'))) || |
775 | 775 | ($this->port == 443 && in_array($this->method, array('https', 'h2')))) { |
776 | - return $url . $this->path; |
|
776 | + return $url.$this->path; |
|
777 | 777 | } else { |
778 | - return $url . ':' . $this->port . $this->path; |
|
778 | + return $url.':'.$this->port.$this->path; |
|
779 | 779 | } |
780 | 780 | } |
781 | 781 | |
@@ -818,7 +818,7 @@ discard block |
||
818 | 818 | public function send($req, $timeout = 0, $method = '') |
819 | 819 | { |
820 | 820 | if ($method !== '' || $timeout !== 0) { |
821 | - $this->logDeprecation("Using non-default values for arguments 'method' and 'timeout' when calling method " . __METHOD__ . ' is deprecated'); |
|
821 | + $this->logDeprecation("Using non-default values for arguments 'method' and 'timeout' when calling method ".__METHOD__.' is deprecated'); |
|
822 | 822 | } |
823 | 823 | |
824 | 824 | // if user does not specify http protocol, use native method of this client |
@@ -937,7 +937,7 @@ discard block |
||
937 | 937 | $payload = $a; |
938 | 938 | $encodingHdr = "Content-Encoding: gzip\r\n"; |
939 | 939 | } else { |
940 | - $this->getLogger()->warning('XML-RPC: ' . __METHOD__ . ': gzencode failure in compressing request'); |
|
940 | + $this->getLogger()->warning('XML-RPC: '.__METHOD__.': gzencode failure in compressing request'); |
|
941 | 941 | } |
942 | 942 | } else if (function_exists('gzcompress')) { |
943 | 943 | $a = @gzcompress($payload); |
@@ -945,14 +945,14 @@ discard block |
||
945 | 945 | $payload = $a; |
946 | 946 | $encodingHdr = "Content-Encoding: deflate\r\n"; |
947 | 947 | } else { |
948 | - $this->getLogger()->warning('XML-RPC: ' . __METHOD__ . ': gzcompress failure in compressing request'); |
|
948 | + $this->getLogger()->warning('XML-RPC: '.__METHOD__.': gzcompress failure in compressing request'); |
|
949 | 949 | } |
950 | 950 | } else { |
951 | - $this->getLogger()->warning('XML-RPC: ' . __METHOD__ . ': desired request compression method is unsupported by this PHP install'); |
|
951 | + $this->getLogger()->warning('XML-RPC: '.__METHOD__.': desired request compression method is unsupported by this PHP install'); |
|
952 | 952 | } |
953 | 953 | } else { |
954 | 954 | if ($opts['request_compression'] != '') { |
955 | - $this->getLogger()->warning('XML-RPC: ' . __METHOD__ . ': desired request compression method is unsupported'); |
|
955 | + $this->getLogger()->warning('XML-RPC: '.__METHOD__.': desired request compression method is unsupported'); |
|
956 | 956 | } |
957 | 957 | } |
958 | 958 | |
@@ -960,16 +960,16 @@ discard block |
||
960 | 960 | $credentials = ''; |
961 | 961 | if ($opts['username'] != '') { |
962 | 962 | if ($opts['authtype'] != 1) { |
963 | - $this->getLogger()->error('XML-RPC: ' . __METHOD__ . ': warning. Only Basic auth is supported with HTTP 1.0'); |
|
963 | + $this->getLogger()->error('XML-RPC: '.__METHOD__.': warning. Only Basic auth is supported with HTTP 1.0'); |
|
964 | 964 | return new static::$responseClass(0, PhpXmlRpc::$xmlrpcerr['unsupported_option'], |
965 | - PhpXmlRpc::$xmlrpcerr['unsupported_option'] . ': only Basic auth is supported with HTTP 1.0'); |
|
965 | + PhpXmlRpc::$xmlrpcerr['unsupported_option'].': only Basic auth is supported with HTTP 1.0'); |
|
966 | 966 | } |
967 | - $credentials = 'Authorization: Basic ' . base64_encode($opts['username'] . ':' . $opts['password']) . "\r\n"; |
|
967 | + $credentials = 'Authorization: Basic '.base64_encode($opts['username'].':'.$opts['password'])."\r\n"; |
|
968 | 968 | } |
969 | 969 | |
970 | 970 | $acceptedEncoding = ''; |
971 | 971 | if (is_array($opts['accepted_compression']) && count($opts['accepted_compression'])) { |
972 | - $acceptedEncoding = 'Accept-Encoding: ' . implode(', ', $opts['accepted_compression']) . "\r\n"; |
|
972 | + $acceptedEncoding = 'Accept-Encoding: '.implode(', ', $opts['accepted_compression'])."\r\n"; |
|
973 | 973 | } |
974 | 974 | |
975 | 975 | if ($port == 0) { |
@@ -985,15 +985,15 @@ discard block |
||
985 | 985 | $connectPort = $opts['proxyport']; |
986 | 986 | $transport = 'tcp'; |
987 | 987 | /// @todo check: should we not use https in some cases? |
988 | - $uri = 'http://' . $server . ':' . $port . $path; |
|
988 | + $uri = 'http://'.$server.':'.$port.$path; |
|
989 | 989 | if ($opts['proxy_user'] != '') { |
990 | 990 | if ($opts['proxy_authtype'] != 1) { |
991 | - $this->getLogger()->error('XML-RPC: ' . __METHOD__ . ': warning. Only Basic auth to proxy is supported with HTTP 1.0'); |
|
991 | + $this->getLogger()->error('XML-RPC: '.__METHOD__.': warning. Only Basic auth to proxy is supported with HTTP 1.0'); |
|
992 | 992 | return new static::$responseClass(0, PhpXmlRpc::$xmlrpcerr['unsupported_option'], |
993 | - PhpXmlRpc::$xmlrpcerr['unsupported_option'] . ': only Basic auth to proxy is supported with HTTP 1.0'); |
|
993 | + PhpXmlRpc::$xmlrpcerr['unsupported_option'].': only Basic auth to proxy is supported with HTTP 1.0'); |
|
994 | 994 | } |
995 | - $proxyCredentials = 'Proxy-Authorization: Basic ' . base64_encode($opts['proxy_user'] . ':' . |
|
996 | - $opts['proxy_pass']) . "\r\n"; |
|
995 | + $proxyCredentials = 'Proxy-Authorization: Basic '.base64_encode($opts['proxy_user'].':'. |
|
996 | + $opts['proxy_pass'])."\r\n"; |
|
997 | 997 | } |
998 | 998 | } else { |
999 | 999 | $connectServer = $server; |
@@ -1009,38 +1009,38 @@ discard block |
||
1009 | 1009 | $version = ''; |
1010 | 1010 | foreach ($opts['cookies'] as $name => $cookie) { |
1011 | 1011 | /// @todo should we sanitize the cookie value on behalf of the user? See setCookie comments |
1012 | - $cookieHeader .= ' ' . $name . '=' . $cookie['value'] . ";"; |
|
1012 | + $cookieHeader .= ' '.$name.'='.$cookie['value'].";"; |
|
1013 | 1013 | } |
1014 | - $cookieHeader = 'Cookie:' . $version . substr($cookieHeader, 0, -1) . "\r\n"; |
|
1014 | + $cookieHeader = 'Cookie:'.$version.substr($cookieHeader, 0, -1)."\r\n"; |
|
1015 | 1015 | } |
1016 | 1016 | |
1017 | 1017 | $extraHeaders = ''; |
1018 | 1018 | if (is_array($this->extra_headers) && $this->extra_headers) { |
1019 | - $extraHeaders = implode("\r\n", $this->extra_headers) . "\r\n"; |
|
1019 | + $extraHeaders = implode("\r\n", $this->extra_headers)."\r\n"; |
|
1020 | 1020 | } |
1021 | 1021 | |
1022 | 1022 | // omit port if default |
1023 | 1023 | if (($port == 80 && in_array($method, array('http', 'http10'))) || ($port == 443 && $method == 'https')) { |
1024 | 1024 | $port = ''; |
1025 | 1025 | } else { |
1026 | - $port = ':' . $port; |
|
1027 | - } |
|
1028 | - |
|
1029 | - $op = 'POST ' . $uri . " HTTP/1.0\r\n" . |
|
1030 | - 'User-Agent: ' . $opts['user_agent'] . "\r\n" . |
|
1031 | - 'Host: ' . $server . $port . "\r\n" . |
|
1032 | - $credentials . |
|
1033 | - $proxyCredentials . |
|
1034 | - $acceptedEncoding . |
|
1035 | - $encodingHdr . |
|
1036 | - 'Accept-Charset: ' . implode(',', $opts['accepted_charset_encodings']) . "\r\n" . |
|
1037 | - $cookieHeader . |
|
1038 | - 'Content-Type: ' . $req->getContentType() . "\r\n" . |
|
1039 | - $extraHeaders . |
|
1040 | - 'Content-Length: ' . strlen($payload) . "\r\n\r\n" . |
|
1026 | + $port = ':'.$port; |
|
1027 | + } |
|
1028 | + |
|
1029 | + $op = 'POST '.$uri." HTTP/1.0\r\n". |
|
1030 | + 'User-Agent: '.$opts['user_agent']."\r\n". |
|
1031 | + 'Host: '.$server.$port."\r\n". |
|
1032 | + $credentials. |
|
1033 | + $proxyCredentials. |
|
1034 | + $acceptedEncoding. |
|
1035 | + $encodingHdr. |
|
1036 | + 'Accept-Charset: '.implode(',', $opts['accepted_charset_encodings'])."\r\n". |
|
1037 | + $cookieHeader. |
|
1038 | + 'Content-Type: '.$req->getContentType()."\r\n". |
|
1039 | + $extraHeaders. |
|
1040 | + 'Content-Length: '.strlen($payload)."\r\n\r\n". |
|
1041 | 1041 | $payload; |
1042 | 1042 | |
1043 | - if ($opts['debug'] > 1) { |
|
1043 | + if ($opts['debug']>1) { |
|
1044 | 1044 | $this->getLogger()->debug("---SENDING---\n$op\n---END---"); |
1045 | 1045 | } |
1046 | 1046 | |
@@ -1066,7 +1066,7 @@ discard block |
||
1066 | 1066 | |
1067 | 1067 | if ($opts['sslversion'] != 0) { |
1068 | 1068 | /// @see https://www.php.net/manual/en/function.curl-setopt.php, https://www.php.net/manual/en/migration56.openssl.php |
1069 | - switch($opts['sslversion']) { |
|
1069 | + switch ($opts['sslversion']) { |
|
1070 | 1070 | /// @todo what does this map to? 1.0-1.3? |
1071 | 1071 | //case 1: // TLSv1 |
1072 | 1072 | // break; |
@@ -1090,12 +1090,12 @@ discard block |
||
1090 | 1090 | $contextOptions['ssl']['crypto_method'] = STREAM_CRYPTO_METHOD_TLSv1_3_CLIENT; |
1091 | 1091 | } else { |
1092 | 1092 | return new static::$responseClass(0, PhpXmlRpc::$xmlrpcerr['unsupported_option'], |
1093 | - PhpXmlRpc::$xmlrpcerr['unsupported_option'] . ': TLS-1.3 only is supported with PHP 7.4 or later'); |
|
1093 | + PhpXmlRpc::$xmlrpcerr['unsupported_option'].': TLS-1.3 only is supported with PHP 7.4 or later'); |
|
1094 | 1094 | } |
1095 | 1095 | break; |
1096 | 1096 | default: |
1097 | 1097 | return new static::$responseClass(0, PhpXmlRpc::$xmlrpcerr['unsupported_option'], |
1098 | - PhpXmlRpc::$xmlrpcerr['unsupported_option'] . ': Unsupported required TLS version'); |
|
1098 | + PhpXmlRpc::$xmlrpcerr['unsupported_option'].': Unsupported required TLS version'); |
|
1099 | 1099 | } |
1100 | 1100 | } |
1101 | 1101 | } |
@@ -1108,7 +1108,7 @@ discard block |
||
1108 | 1108 | |
1109 | 1109 | $context = stream_context_create($contextOptions); |
1110 | 1110 | |
1111 | - if ($opts['timeout'] <= 0) { |
|
1111 | + if ($opts['timeout']<=0) { |
|
1112 | 1112 | $connectTimeout = ini_get('default_socket_timeout'); |
1113 | 1113 | } else { |
1114 | 1114 | $connectTimeout = $opts['timeout']; |
@@ -1127,7 +1127,7 @@ discard block |
||
1127 | 1127 | $fp = stream_socket_client("$transport://$connectServer:$connectPort", $this->errno, $this->errstr, $connectTimeout, |
1128 | 1128 | STREAM_CLIENT_CONNECT, $context); |
1129 | 1129 | if ($fp) { |
1130 | - if ($opts['timeout'] > 0) { |
|
1130 | + if ($opts['timeout']>0) { |
|
1131 | 1131 | stream_set_timeout($fp, $opts['timeout'], 0); |
1132 | 1132 | } |
1133 | 1133 | } else { |
@@ -1136,8 +1136,8 @@ discard block |
||
1136 | 1136 | $this->errstr = $err['message']; |
1137 | 1137 | } |
1138 | 1138 | |
1139 | - $this->errstr = 'Connect error: ' . $this->errstr; |
|
1140 | - return new static::$responseClass(0, PhpXmlRpc::$xmlrpcerr['http_error'], $this->errstr . ' (' . $this->errno . ')'); |
|
1139 | + $this->errstr = 'Connect error: '.$this->errstr; |
|
1140 | + return new static::$responseClass(0, PhpXmlRpc::$xmlrpcerr['http_error'], $this->errstr.' ('.$this->errno.')'); |
|
1141 | 1141 | } |
1142 | 1142 | |
1143 | 1143 | if (!fputs($fp, $op, strlen($op))) { |
@@ -1217,19 +1217,19 @@ discard block |
||
1217 | 1217 | $opts['keepalive'], $opts['key'], $opts['keypass'], $opts['sslversion']); |
1218 | 1218 | |
1219 | 1219 | if (!$curl) { |
1220 | - return new static::$responseClass(0, PhpXmlRpc::$xmlrpcerr['curl_fail'], PhpXmlRpc::$xmlrpcstr['curl_fail'] . |
|
1220 | + return new static::$responseClass(0, PhpXmlRpc::$xmlrpcerr['curl_fail'], PhpXmlRpc::$xmlrpcstr['curl_fail']. |
|
1221 | 1221 | ': error during curl initialization. Check php error log for details'); |
1222 | 1222 | } |
1223 | 1223 | |
1224 | 1224 | $result = curl_exec($curl); |
1225 | 1225 | |
1226 | - if ($opts['debug'] > 1) { |
|
1226 | + if ($opts['debug']>1) { |
|
1227 | 1227 | $message = "---CURL INFO---\n"; |
1228 | 1228 | foreach (curl_getinfo($curl) as $name => $val) { |
1229 | 1229 | if (is_array($val)) { |
1230 | 1230 | $val = implode("\n", $val); |
1231 | 1231 | } |
1232 | - $message .= $name . ': ' . $val . "\n"; |
|
1232 | + $message .= $name.': '.$val."\n"; |
|
1233 | 1233 | } |
1234 | 1234 | $message .= '---END---'; |
1235 | 1235 | $this->getLogger()->debug($message); |
@@ -1239,8 +1239,8 @@ discard block |
||
1239 | 1239 | /// @todo we should use a better check here - what if we get back '' or '0'? |
1240 | 1240 | |
1241 | 1241 | $this->errstr = 'no response'; |
1242 | - $resp = new static::$responseClass(0, PhpXmlRpc::$xmlrpcerr['curl_fail'], PhpXmlRpc::$xmlrpcstr['curl_fail'] . |
|
1243 | - ': ' . curl_error($curl)); |
|
1242 | + $resp = new static::$responseClass(0, PhpXmlRpc::$xmlrpcerr['curl_fail'], PhpXmlRpc::$xmlrpcstr['curl_fail']. |
|
1243 | + ': '.curl_error($curl)); |
|
1244 | 1244 | curl_close($curl); |
1245 | 1245 | if ($opts['keepalive']) { |
1246 | 1246 | $this->xmlrpc_curl_handle = null; |
@@ -1298,7 +1298,7 @@ discard block |
||
1298 | 1298 | $payload = $a; |
1299 | 1299 | $encodingHdr = 'Content-Encoding: gzip'; |
1300 | 1300 | } else { |
1301 | - $this->getLogger()->warning('XML-RPC: ' . __METHOD__ . ': gzencode failure in compressing request'); |
|
1301 | + $this->getLogger()->warning('XML-RPC: '.__METHOD__.': gzencode failure in compressing request'); |
|
1302 | 1302 | } |
1303 | 1303 | } else if (function_exists('gzcompress')) { |
1304 | 1304 | $a = @gzcompress($payload); |
@@ -1306,14 +1306,14 @@ discard block |
||
1306 | 1306 | $payload = $a; |
1307 | 1307 | $encodingHdr = 'Content-Encoding: deflate'; |
1308 | 1308 | } else { |
1309 | - $this->getLogger()->warning('XML-RPC: ' . __METHOD__ . ': gzcompress failure in compressing request'); |
|
1309 | + $this->getLogger()->warning('XML-RPC: '.__METHOD__.': gzcompress failure in compressing request'); |
|
1310 | 1310 | } |
1311 | 1311 | } else { |
1312 | - $this->getLogger()->warning('XML-RPC: ' . __METHOD__ . ': desired request compression method is unsupported by this PHP install'); |
|
1312 | + $this->getLogger()->warning('XML-RPC: '.__METHOD__.': desired request compression method is unsupported by this PHP install'); |
|
1313 | 1313 | } |
1314 | 1314 | } else { |
1315 | 1315 | if ($opts['request_compression'] != '') { |
1316 | - $this->getLogger()->warning('XML-RPC: ' . __METHOD__ . ': desired request compression method is unsupported'); |
|
1316 | + $this->getLogger()->warning('XML-RPC: '.__METHOD__.': desired request compression method is unsupported'); |
|
1317 | 1317 | } |
1318 | 1318 | } |
1319 | 1319 | |
@@ -1327,12 +1327,12 @@ discard block |
||
1327 | 1327 | // http, https |
1328 | 1328 | $protocol = $method; |
1329 | 1329 | if (strpos($protocol, ':') !== false) { |
1330 | - $this->getLogger()->error('XML-RPC: ' . __METHOD__ . ": warning - attempted hacking attempt?. The curl protocol requested for the call is: '$protocol'"); |
|
1330 | + $this->getLogger()->error('XML-RPC: '.__METHOD__.": warning - attempted hacking attempt?. The curl protocol requested for the call is: '$protocol'"); |
|
1331 | 1331 | return false; |
1332 | 1332 | } |
1333 | 1333 | } |
1334 | 1334 | } |
1335 | - $curl = curl_init($protocol . '://' . $server . ':' . $port . $path); |
|
1335 | + $curl = curl_init($protocol.'://'.$server.':'.$port.$path); |
|
1336 | 1336 | if (!$curl) { |
1337 | 1337 | return false; |
1338 | 1338 | } |
@@ -1346,7 +1346,7 @@ discard block |
||
1346 | 1346 | // results into variable |
1347 | 1347 | curl_setopt($curl, CURLOPT_RETURNTRANSFER, true); |
1348 | 1348 | |
1349 | - if ($opts['debug'] > 1) { |
|
1349 | + if ($opts['debug']>1) { |
|
1350 | 1350 | curl_setopt($curl, CURLOPT_VERBOSE, true); |
1351 | 1351 | /// @todo redirect curlopt_stderr to some stream which can be piped to the logger |
1352 | 1352 | } |
@@ -1371,7 +1371,7 @@ discard block |
||
1371 | 1371 | } |
1372 | 1372 | } |
1373 | 1373 | // extra headers |
1374 | - $headers = array('Content-Type: ' . $req->getContentType(), 'Accept-Charset: ' . implode(',', $opts['accepted_charset_encodings'])); |
|
1374 | + $headers = array('Content-Type: '.$req->getContentType(), 'Accept-Charset: '.implode(',', $opts['accepted_charset_encodings'])); |
|
1375 | 1375 | // if no keepalive is wanted, let the server know it in advance |
1376 | 1376 | if (!$opts['keepalive']) { |
1377 | 1377 | $headers[] = 'Connection: close'; |
@@ -1407,7 +1407,7 @@ discard block |
||
1407 | 1407 | if (defined('CURL_HTTP_VERSION_2_PRIOR_KNOWLEDGE')) { |
1408 | 1408 | curl_setopt($curl, CURLOPT_HTTP_VERSION, CURL_HTTP_VERSION_2_PRIOR_KNOWLEDGE); |
1409 | 1409 | } else { |
1410 | - $this->getLogger()->error('XML-RPC: ' . __METHOD__ . ': warning. HTTP2 is not supported by the current PHP/curl install'); |
|
1410 | + $this->getLogger()->error('XML-RPC: '.__METHOD__.': warning. HTTP2 is not supported by the current PHP/curl install'); |
|
1411 | 1411 | curl_close($curl); |
1412 | 1412 | return false; |
1413 | 1413 | } |
@@ -1418,11 +1418,11 @@ discard block |
||
1418 | 1418 | } |
1419 | 1419 | |
1420 | 1420 | if ($opts['username'] && $opts['password']) { |
1421 | - curl_setopt($curl, CURLOPT_USERPWD, $opts['username'] . ':' . $opts['password']); |
|
1421 | + curl_setopt($curl, CURLOPT_USERPWD, $opts['username'].':'.$opts['password']); |
|
1422 | 1422 | if (defined('CURLOPT_HTTPAUTH')) { |
1423 | 1423 | curl_setopt($curl, CURLOPT_HTTPAUTH, $opts['authtype']); |
1424 | 1424 | } elseif ($opts['authtype'] != 1) { |
1425 | - $this->getLogger()->error('XML-RPC: ' . __METHOD__ . ': warning. Only Basic auth is supported by the current PHP/curl install'); |
|
1425 | + $this->getLogger()->error('XML-RPC: '.__METHOD__.': warning. Only Basic auth is supported by the current PHP/curl install'); |
|
1426 | 1426 | curl_close($curl); |
1427 | 1427 | return false; |
1428 | 1428 | } |
@@ -1467,13 +1467,13 @@ discard block |
||
1467 | 1467 | if ($opts['proxyport'] == 0) { |
1468 | 1468 | $opts['proxyport'] = 8080; // NB: even for HTTPS, local connection is on port 8080 |
1469 | 1469 | } |
1470 | - curl_setopt($curl, CURLOPT_PROXY, $opts['proxy'] . ':' . $opts['proxyport']); |
|
1470 | + curl_setopt($curl, CURLOPT_PROXY, $opts['proxy'].':'.$opts['proxyport']); |
|
1471 | 1471 | if ($opts['proxy_user']) { |
1472 | - curl_setopt($curl, CURLOPT_PROXYUSERPWD, $opts['proxy_user'] . ':' . $opts['proxy_pass']); |
|
1472 | + curl_setopt($curl, CURLOPT_PROXYUSERPWD, $opts['proxy_user'].':'.$opts['proxy_pass']); |
|
1473 | 1473 | if (defined('CURLOPT_PROXYAUTH')) { |
1474 | 1474 | curl_setopt($curl, CURLOPT_PROXYAUTH, $opts['proxy_authtype']); |
1475 | 1475 | } elseif ($opts['proxy_authtype'] != 1) { |
1476 | - $this->getLogger()->error('XML-RPC: ' . __METHOD__ . ': warning. Only Basic auth to proxy is supported by the current PHP/curl install'); |
|
1476 | + $this->getLogger()->error('XML-RPC: '.__METHOD__.': warning. Only Basic auth to proxy is supported by the current PHP/curl install'); |
|
1477 | 1477 | curl_close($curl); |
1478 | 1478 | return false; |
1479 | 1479 | } |
@@ -1485,7 +1485,7 @@ discard block |
||
1485 | 1485 | if (count($opts['cookies'])) { |
1486 | 1486 | $cookieHeader = ''; |
1487 | 1487 | foreach ($opts['cookies'] as $name => $cookie) { |
1488 | - $cookieHeader .= $name . '=' . $cookie['value'] . '; '; |
|
1488 | + $cookieHeader .= $name.'='.$cookie['value'].'; '; |
|
1489 | 1489 | } |
1490 | 1490 | curl_setopt($curl, CURLOPT_COOKIE, substr($cookieHeader, 0, -2)); |
1491 | 1491 | } |
@@ -1494,7 +1494,7 @@ discard block |
||
1494 | 1494 | curl_setopt($curl, $opt, $val); |
1495 | 1495 | } |
1496 | 1496 | |
1497 | - if ($opts['debug'] > 1) { |
|
1497 | + if ($opts['debug']>1) { |
|
1498 | 1498 | $this->getLogger()->debug("---SENDING---\n$payload\n---END---"); |
1499 | 1499 | } |
1500 | 1500 | |
@@ -1595,7 +1595,7 @@ discard block |
||
1595 | 1595 | $call['methodName'] = new Value($req->method(), 'string'); |
1596 | 1596 | $numParams = $req->getNumParams(); |
1597 | 1597 | $params = array(); |
1598 | - for ($i = 0; $i < $numParams; $i++) { |
|
1598 | + for ($i = 0; $i<$numParams; $i++) { |
|
1599 | 1599 | $params[$i] = $req->getParam($i); |
1600 | 1600 | } |
1601 | 1601 | $call['params'] = new Value($params, 'array'); |
@@ -1617,7 +1617,7 @@ discard block |
||
1617 | 1617 | $response = array(); |
1618 | 1618 | |
1619 | 1619 | if ($this->return_type == 'xml') { |
1620 | - for ($i = 0; $i < count($reqs); $i++) { |
|
1620 | + for ($i = 0; $i<count($reqs); $i++) { |
|
1621 | 1621 | $response[] = new static::$responseClass($rets, 0, '', 'xml', $result->httpResponse()); |
1622 | 1622 | } |
1623 | 1623 | |
@@ -1625,21 +1625,21 @@ discard block |
||
1625 | 1625 | if (!is_array($rets)) { |
1626 | 1626 | // bad return type from system.multicall |
1627 | 1627 | return new static::$responseClass(0, PhpXmlRpc::$xmlrpcerr['multicall_error'], |
1628 | - PhpXmlRpc::$xmlrpcstr['multicall_error'] . ': not an array', 'phpvals', $result->httpResponse()); |
|
1628 | + PhpXmlRpc::$xmlrpcstr['multicall_error'].': not an array', 'phpvals', $result->httpResponse()); |
|
1629 | 1629 | } |
1630 | 1630 | $numRets = count($rets); |
1631 | 1631 | if ($numRets != count($reqs)) { |
1632 | 1632 | // wrong number of return values. |
1633 | 1633 | return new static::$responseClass(0, PhpXmlRpc::$xmlrpcerr['multicall_error'], |
1634 | - PhpXmlRpc::$xmlrpcstr['multicall_error'] . ': incorrect number of responses', 'phpvals', |
|
1634 | + PhpXmlRpc::$xmlrpcstr['multicall_error'].': incorrect number of responses', 'phpvals', |
|
1635 | 1635 | $result->httpResponse()); |
1636 | 1636 | } |
1637 | 1637 | |
1638 | - for ($i = 0; $i < $numRets; $i++) { |
|
1638 | + for ($i = 0; $i<$numRets; $i++) { |
|
1639 | 1639 | $val = $rets[$i]; |
1640 | 1640 | if (!is_array($val)) { |
1641 | 1641 | return new static::$responseClass(0, PhpXmlRpc::$xmlrpcerr['multicall_error'], |
1642 | - PhpXmlRpc::$xmlrpcstr['multicall_error'] . ": response element $i is not an array or struct", |
|
1642 | + PhpXmlRpc::$xmlrpcstr['multicall_error'].": response element $i is not an array or struct", |
|
1643 | 1643 | 'phpvals', $result->httpResponse()); |
1644 | 1644 | } |
1645 | 1645 | switch (count($val)) { |
@@ -1647,7 +1647,7 @@ discard block |
||
1647 | 1647 | if (!isset($val[0])) { |
1648 | 1648 | // Bad value |
1649 | 1649 | return new static::$responseClass(0, PhpXmlRpc::$xmlrpcerr['multicall_error'], |
1650 | - PhpXmlRpc::$xmlrpcstr['multicall_error'] . ": response element $i has no value", |
|
1650 | + PhpXmlRpc::$xmlrpcstr['multicall_error'].": response element $i has no value", |
|
1651 | 1651 | 'phpvals', $result->httpResponse()); |
1652 | 1652 | } |
1653 | 1653 | // Normal return value |
@@ -1659,20 +1659,20 @@ discard block |
||
1659 | 1659 | if (!is_int($code)) { |
1660 | 1660 | /// @todo should we check that it is != 0? |
1661 | 1661 | return new static::$responseClass(0, PhpXmlRpc::$xmlrpcerr['multicall_error'], |
1662 | - PhpXmlRpc::$xmlrpcstr['multicall_error'] . ": response element $i has invalid or no faultCode", |
|
1662 | + PhpXmlRpc::$xmlrpcstr['multicall_error'].": response element $i has invalid or no faultCode", |
|
1663 | 1663 | 'phpvals', $result->httpResponse()); |
1664 | 1664 | } |
1665 | 1665 | $str = @$val['faultString']; |
1666 | 1666 | if (!is_string($str)) { |
1667 | 1667 | return new static::$responseClass(0, PhpXmlRpc::$xmlrpcerr['multicall_error'], |
1668 | - PhpXmlRpc::$xmlrpcstr['multicall_error'] . ": response element $i has invalid or no FaultString", |
|
1668 | + PhpXmlRpc::$xmlrpcstr['multicall_error'].": response element $i has invalid or no FaultString", |
|
1669 | 1669 | 'phpvals', $result->httpResponse()); |
1670 | 1670 | } |
1671 | 1671 | $response[$i] = new static::$responseClass(0, $code, $str, 'phpvals', $result->httpResponse()); |
1672 | 1672 | break; |
1673 | 1673 | default: |
1674 | 1674 | return new static::$responseClass(0, PhpXmlRpc::$xmlrpcerr['multicall_error'], |
1675 | - PhpXmlRpc::$xmlrpcstr['multicall_error'] . ": response element $i has too many items", |
|
1675 | + PhpXmlRpc::$xmlrpcstr['multicall_error'].": response element $i has too many items", |
|
1676 | 1676 | 'phpvals', $result->httpResponse()); |
1677 | 1677 | } |
1678 | 1678 | } |
@@ -1681,14 +1681,14 @@ discard block |
||
1681 | 1681 | // return type == 'xmlrpcvals' |
1682 | 1682 | if ($rets->kindOf() != 'array') { |
1683 | 1683 | return new static::$responseClass(0, PhpXmlRpc::$xmlrpcerr['multicall_error'], |
1684 | - PhpXmlRpc::$xmlrpcstr['multicall_error'] . ": response element $i is not an array", 'xmlrpcvals', |
|
1684 | + PhpXmlRpc::$xmlrpcstr['multicall_error'].": response element $i is not an array", 'xmlrpcvals', |
|
1685 | 1685 | $result->httpResponse()); |
1686 | 1686 | } |
1687 | 1687 | $numRets = $rets->count(); |
1688 | 1688 | if ($numRets != count($reqs)) { |
1689 | 1689 | // wrong number of return values. |
1690 | 1690 | return new static::$responseClass(0, PhpXmlRpc::$xmlrpcerr['multicall_error'], |
1691 | - PhpXmlRpc::$xmlrpcstr['multicall_error'] . ': incorrect number of responses', 'xmlrpcvals', |
|
1691 | + PhpXmlRpc::$xmlrpcstr['multicall_error'].': incorrect number of responses', 'xmlrpcvals', |
|
1692 | 1692 | $result->httpResponse()); |
1693 | 1693 | } |
1694 | 1694 | |
@@ -1697,7 +1697,7 @@ discard block |
||
1697 | 1697 | case 'array': |
1698 | 1698 | if ($val->count() != 1) { |
1699 | 1699 | return new static::$responseClass(0, PhpXmlRpc::$xmlrpcerr['multicall_error'], |
1700 | - PhpXmlRpc::$xmlrpcstr['multicall_error'] . ": response element $i has too many items", |
|
1700 | + PhpXmlRpc::$xmlrpcstr['multicall_error'].": response element $i has too many items", |
|
1701 | 1701 | 'phpvals', $result->httpResponse()); |
1702 | 1702 | } |
1703 | 1703 | // Normal return value |
@@ -1706,28 +1706,28 @@ discard block |
||
1706 | 1706 | case 'struct': |
1707 | 1707 | if ($val->count() != 2) { |
1708 | 1708 | return new static::$responseClass(0, PhpXmlRpc::$xmlrpcerr['multicall_error'], |
1709 | - PhpXmlRpc::$xmlrpcstr['multicall_error'] . ": response element $i has too many items", |
|
1709 | + PhpXmlRpc::$xmlrpcstr['multicall_error'].": response element $i has too many items", |
|
1710 | 1710 | 'phpvals', $result->httpResponse()); |
1711 | 1711 | } |
1712 | 1712 | /** @var Value $code */ |
1713 | 1713 | $code = $val['faultCode']; |
1714 | 1714 | if ($code->kindOf() != 'scalar' || $code->scalarTyp() != 'int') { |
1715 | 1715 | return new static::$responseClass(0, PhpXmlRpc::$xmlrpcerr['multicall_error'], |
1716 | - PhpXmlRpc::$xmlrpcstr['multicall_error'] . ": response element $i has invalid or no faultCode", |
|
1716 | + PhpXmlRpc::$xmlrpcstr['multicall_error'].": response element $i has invalid or no faultCode", |
|
1717 | 1717 | 'xmlrpcvals', $result->httpResponse()); |
1718 | 1718 | } |
1719 | 1719 | /** @var Value $str */ |
1720 | 1720 | $str = $val['faultString']; |
1721 | 1721 | if ($str->kindOf() != 'scalar' || $str->scalarTyp() != 'string') { |
1722 | 1722 | return new static::$responseClass(0, PhpXmlRpc::$xmlrpcerr['multicall_error'], |
1723 | - PhpXmlRpc::$xmlrpcstr['multicall_error'] . ": response element $i has invalid or no faultCode", |
|
1723 | + PhpXmlRpc::$xmlrpcstr['multicall_error'].": response element $i has invalid or no faultCode", |
|
1724 | 1724 | 'xmlrpcvals', $result->httpResponse()); |
1725 | 1725 | } |
1726 | 1726 | $response[] = new static::$responseClass(0, $code->scalarVal(), $str->scalarVal(), 'xmlrpcvals', $result->httpResponse()); |
1727 | 1727 | break; |
1728 | 1728 | default: |
1729 | 1729 | return new static::$responseClass(0, PhpXmlRpc::$xmlrpcerr['multicall_error'], |
1730 | - PhpXmlRpc::$xmlrpcstr['multicall_error'] . ": response element $i is not an array or struct", |
|
1730 | + PhpXmlRpc::$xmlrpcstr['multicall_error'].": response element $i is not an array or struct", |
|
1731 | 1731 | 'xmlrpcvals', $result->httpResponse()); |
1732 | 1732 | } |
1733 | 1733 | } |
@@ -1760,7 +1760,7 @@ discard block |
||
1760 | 1760 | $authType = 1, $proxyHost = '', $proxyPort = 0, $proxyUsername = '', $proxyPassword = '', $proxyAuthType = 1, |
1761 | 1761 | $method = 'http') |
1762 | 1762 | { |
1763 | - $this->logDeprecation('Method ' . __METHOD__ . ' is deprecated'); |
|
1763 | + $this->logDeprecation('Method '.__METHOD__.' is deprecated'); |
|
1764 | 1764 | |
1765 | 1765 | return $this->sendPayloadSocket($req, $server, $port, $timeout, $username, $password, $authType, null, null, |
1766 | 1766 | null, null, $proxyHost, $proxyPort, $proxyUsername, $proxyPassword, $proxyAuthType, $method); |
@@ -1796,7 +1796,7 @@ discard block |
||
1796 | 1796 | $proxyUsername = '', $proxyPassword = '', $proxyAuthType = 1, $keepAlive = false, $key = '', $keyPass = '', |
1797 | 1797 | $sslVersion = 0) |
1798 | 1798 | { |
1799 | - $this->logDeprecation('Method ' . __METHOD__ . ' is deprecated'); |
|
1799 | + $this->logDeprecation('Method '.__METHOD__.' is deprecated'); |
|
1800 | 1800 | |
1801 | 1801 | return $this->sendPayloadCURL($req, $server, $port, $timeout, $username, |
1802 | 1802 | $password, $authType, $cert, $certPass, $caCert, $caCertDir, $proxyHost, $proxyPort, |
@@ -2009,7 +2009,7 @@ discard block |
||
2009 | 2009 | public function &__get($name) |
2010 | 2010 | { |
2011 | 2011 | if (in_array($name, static::$options)) { |
2012 | - $this->logDeprecation('Getting property Client::' . $name . ' is deprecated'); |
|
2012 | + $this->logDeprecation('Getting property Client::'.$name.' is deprecated'); |
|
2013 | 2013 | return $this->$name; |
2014 | 2014 | } |
2015 | 2015 | |
@@ -2020,12 +2020,12 @@ discard block |
||
2020 | 2020 | case 'server': |
2021 | 2021 | case 'port': |
2022 | 2022 | case 'path': |
2023 | - $this->logDeprecation('Getting property Client::' . $name . ' is deprecated'); |
|
2023 | + $this->logDeprecation('Getting property Client::'.$name.' is deprecated'); |
|
2024 | 2024 | return $this->$name; |
2025 | 2025 | default: |
2026 | 2026 | /// @todo throw instead? There are very few other places where the lib trigger errors which can potentially reach stdout... |
2027 | 2027 | $trace = debug_backtrace(DEBUG_BACKTRACE_IGNORE_ARGS, 1); |
2028 | - trigger_error('Undefined property via __get(): ' . $name . ' in ' . $trace[0]['file'] . ' on line ' . $trace[0]['line'], E_USER_WARNING); |
|
2028 | + trigger_error('Undefined property via __get(): '.$name.' in '.$trace[0]['file'].' on line '.$trace[0]['line'], E_USER_WARNING); |
|
2029 | 2029 | $result = null; |
2030 | 2030 | return $result; |
2031 | 2031 | } |
@@ -2034,7 +2034,7 @@ discard block |
||
2034 | 2034 | public function __set($name, $value) |
2035 | 2035 | { |
2036 | 2036 | if (in_array($name, static::$options)) { |
2037 | - $this->logDeprecation('Setting property Client::' . $name . ' is deprecated'); |
|
2037 | + $this->logDeprecation('Setting property Client::'.$name.' is deprecated'); |
|
2038 | 2038 | $this->$name = $value; |
2039 | 2039 | return; |
2040 | 2040 | } |
@@ -2046,20 +2046,20 @@ discard block |
||
2046 | 2046 | case 'server': |
2047 | 2047 | case 'port': |
2048 | 2048 | case 'path': |
2049 | - $this->logDeprecation('Setting property Client::' . $name . ' is deprecated'); |
|
2049 | + $this->logDeprecation('Setting property Client::'.$name.' is deprecated'); |
|
2050 | 2050 | $this->$name = $value; |
2051 | 2051 | return; |
2052 | 2052 | default: |
2053 | 2053 | /// @todo throw instead? There are very few other places where the lib trigger errors which can potentially reach stdout... |
2054 | 2054 | $trace = debug_backtrace(DEBUG_BACKTRACE_IGNORE_ARGS, 1); |
2055 | - trigger_error('Undefined property via __set(): ' . $name . ' in ' . $trace[0]['file'] . ' on line ' . $trace[0]['line'], E_USER_WARNING); |
|
2055 | + trigger_error('Undefined property via __set(): '.$name.' in '.$trace[0]['file'].' on line '.$trace[0]['line'], E_USER_WARNING); |
|
2056 | 2056 | } |
2057 | 2057 | } |
2058 | 2058 | |
2059 | 2059 | public function __isset($name) |
2060 | 2060 | { |
2061 | 2061 | if (in_array($name, static::$options)) { |
2062 | - $this->logDeprecation('Checking property Client::' . $name . ' is deprecated'); |
|
2062 | + $this->logDeprecation('Checking property Client::'.$name.' is deprecated'); |
|
2063 | 2063 | return isset($this->$name); |
2064 | 2064 | } |
2065 | 2065 | |
@@ -2070,7 +2070,7 @@ discard block |
||
2070 | 2070 | case 'server': |
2071 | 2071 | case 'port': |
2072 | 2072 | case 'path': |
2073 | - $this->logDeprecation('Checking property Client::' . $name . ' is deprecated'); |
|
2073 | + $this->logDeprecation('Checking property Client::'.$name.' is deprecated'); |
|
2074 | 2074 | return isset($this->$name); |
2075 | 2075 | default: |
2076 | 2076 | return false; |
@@ -2080,7 +2080,7 @@ discard block |
||
2080 | 2080 | public function __unset($name) |
2081 | 2081 | { |
2082 | 2082 | if (in_array($name, static::$options)) { |
2083 | - $this->logDeprecation('Unsetting property Client::' . $name . ' is deprecated'); |
|
2083 | + $this->logDeprecation('Unsetting property Client::'.$name.' is deprecated'); |
|
2084 | 2084 | unset($this->$name); |
2085 | 2085 | return; |
2086 | 2086 | } |
@@ -2092,13 +2092,13 @@ discard block |
||
2092 | 2092 | case 'server': |
2093 | 2093 | case 'port': |
2094 | 2094 | case 'path': |
2095 | - $this->logDeprecation('Unsetting property Client::' . $name . ' is deprecated'); |
|
2095 | + $this->logDeprecation('Unsetting property Client::'.$name.' is deprecated'); |
|
2096 | 2096 | unset($this->$name); |
2097 | 2097 | return; |
2098 | 2098 | default: |
2099 | 2099 | /// @todo throw instead? There are very few other places where the lib trigger errors which can potentially reach stdout... |
2100 | 2100 | $trace = debug_backtrace(DEBUG_BACKTRACE_IGNORE_ARGS, 1); |
2101 | - trigger_error('Undefined property via __unset(): ' . $name . ' in ' . $trace[0]['file'] . ' on line ' . $trace[0]['line'], E_USER_WARNING); |
|
2101 | + trigger_error('Undefined property via __unset(): '.$name.' in '.$trace[0]['file'].' on line '.$trace[0]['line'], E_USER_WARNING); |
|
2102 | 2102 | } |
2103 | 2103 | } |
2104 | 2104 | } |