@@ -1,6 +1,6 @@ discard block |
||
| 1 | 1 | <?php |
| 2 | 2 | |
| 3 | -include_once __DIR__ . '/WebTestCase.php'; |
|
| 3 | +include_once __DIR__.'/WebTestCase.php'; |
|
| 4 | 4 | |
| 5 | 5 | /** |
| 6 | 6 | * Tests for php files in the 'extras' directory. |
@@ -12,8 +12,8 @@ discard block |
||
| 12 | 12 | $this->args = argParser::getArgs(); |
| 13 | 13 | |
| 14 | 14 | // assumes HTTPURI to be in the form /tests/index.php?etc... |
| 15 | - $this->baseUrl = 'http://' . $this->args['HTTPSERVER'] . preg_replace('|\?.+|', '', $this->args['HTTPURI']); |
|
| 16 | - $this->coverageScriptUrl = 'http://' . $this->args['HTTPSERVER'] . preg_replace('|/tests/index\.php(\?.*)?|', '/tests/phpunit_coverage.php', $this->args['HTTPURI']); |
|
| 15 | + $this->baseUrl = 'http://'.$this->args['HTTPSERVER'].preg_replace('|\?.+|', '', $this->args['HTTPURI']); |
|
| 16 | + $this->coverageScriptUrl = 'http://'.$this->args['HTTPSERVER'].preg_replace('|/tests/index\.php(\?.*)?|', '/tests/phpunit_coverage.php', $this->args['HTTPURI']); |
|
| 17 | 17 | } |
| 18 | 18 | |
| 19 | 19 | public function testBenchmark() |
@@ -23,14 +23,16 @@ |
||
| 23 | 23 | { |
| 24 | 24 | $this->args = argParser::getArgs(); |
| 25 | 25 | // hide parsing errors unless in debug mode |
| 26 | - if ($this->args['DEBUG'] == 1) |
|
| 27 | - ob_start(); |
|
| 26 | + if ($this->args['DEBUG'] == 1) { |
|
| 27 | + ob_start(); |
|
| 28 | + } |
|
| 28 | 29 | } |
| 29 | 30 | |
| 30 | 31 | protected function tear_down() |
| 31 | 32 | { |
| 32 | - if ($this->args['DEBUG'] != 1) |
|
| 33 | - return; |
|
| 33 | + if ($this->args['DEBUG'] != 1) { |
|
| 34 | + return; |
|
| 35 | + } |
|
| 34 | 36 | $out = ob_get_clean(); |
| 35 | 37 | $status = $this->getStatus(); |
| 36 | 38 | if ($status == BaseTestRunner::STATUS_ERROR |
@@ -1,6 +1,6 @@ discard block |
||
| 1 | 1 | <?php |
| 2 | 2 | |
| 3 | -include_once __DIR__ . '/PolyfillTestCase.php'; |
|
| 3 | +include_once __DIR__.'/PolyfillTestCase.php'; |
|
| 4 | 4 | |
| 5 | 5 | use PhpXmlRpc\Helper\Charset; |
| 6 | 6 | use PhpXmlRpc\Helper\Http; |
@@ -36,9 +36,9 @@ discard block |
||
| 36 | 36 | Http::setLogger($this); |
| 37 | 37 | |
| 38 | 38 | $h = new Http(); |
| 39 | - $s = "HTTP/1.0 200 OK\r\n" . |
|
| 40 | - "Content-Type: unknown\r\n" . |
|
| 41 | - "\r\n" . |
|
| 39 | + $s = "HTTP/1.0 200 OK\r\n". |
|
| 40 | + "Content-Type: unknown\r\n". |
|
| 41 | + "\r\n". |
|
| 42 | 42 | "body"; |
| 43 | 43 | $h->parseResponseHeaders($s, false, 1); |
| 44 | 44 | $this->assertStringContainsString("HEADER: content-type: unknown", $this->debugBuffer); |
@@ -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 | |
@@ -26,13 +26,13 @@ discard block |
||
| 26 | 26 | $this->client->setDebug($this->args['DEBUG']); |
| 27 | 27 | |
| 28 | 28 | // in debug mode, the client will be very verbose. Avoid showing its output unless there are errors |
| 29 | - if ($this->args['DEBUG'] >= 1) |
|
| 29 | + if ($this->args['DEBUG']>=1) |
|
| 30 | 30 | ob_start(); |
| 31 | 31 | } |
| 32 | 32 | |
| 33 | 33 | protected function tear_down() |
| 34 | 34 | { |
| 35 | - if ($this->args['DEBUG'] < 1) |
|
| 35 | + if ($this->args['DEBUG']<1) |
|
| 36 | 36 | return; |
| 37 | 37 | $out = ob_get_clean(); |
| 38 | 38 | $status = $this->getStatus(); |
@@ -59,7 +59,7 @@ discard block |
||
| 59 | 59 | $this->client->server .= 'XXX'; |
| 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 | $r = $this->client->send($m, 5); |
| 65 | 65 | // make sure there's no freaking catchall DNS in effect |
@@ -86,7 +86,7 @@ discard block |
||
| 86 | 86 | |
| 87 | 87 | // now test a successful connection |
| 88 | 88 | $server = explode(':', $this->args['HTTPSERVER']); |
| 89 | - if (count($server) > 1) { |
|
| 89 | + if (count($server)>1) { |
|
| 90 | 90 | $this->client->port = $server[1]; |
| 91 | 91 | } |
| 92 | 92 | $this->client->server = $server[0]; |
@@ -26,14 +26,16 @@ |
||
| 26 | 26 | $this->client->setDebug($this->args['DEBUG']); |
| 27 | 27 | |
| 28 | 28 | // in debug mode, the client will be very verbose. Avoid showing its output unless there are errors |
| 29 | - if ($this->args['DEBUG'] >= 1) |
|
| 30 | - ob_start(); |
|
| 29 | + if ($this->args['DEBUG'] >= 1) { |
|
| 30 | + ob_start(); |
|
| 31 | + } |
|
| 31 | 32 | } |
| 32 | 33 | |
| 33 | 34 | protected function tear_down() |
| 34 | 35 | { |
| 35 | - if ($this->args['DEBUG'] < 1) |
|
| 36 | - return; |
|
| 36 | + if ($this->args['DEBUG'] < 1) { |
|
| 37 | + return; |
|
| 38 | + } |
|
| 37 | 39 | $out = ob_get_clean(); |
| 38 | 40 | $status = $this->getStatus(); |
| 39 | 41 | if ($status == BaseTestRunner::STATUS_ERROR |
@@ -1,11 +1,11 @@ discard block |
||
| 1 | 1 | <?php |
| 2 | 2 | |
| 3 | -include_once __DIR__ . '/../lib/xmlrpc.inc'; |
|
| 4 | -include_once __DIR__ . '/../lib/xmlrpc_wrappers.inc'; |
|
| 3 | +include_once __DIR__.'/../lib/xmlrpc.inc'; |
|
| 4 | +include_once __DIR__.'/../lib/xmlrpc_wrappers.inc'; |
|
| 5 | 5 | |
| 6 | -include_once __DIR__ . '/parse_args.php'; |
|
| 6 | +include_once __DIR__.'/parse_args.php'; |
|
| 7 | 7 | |
| 8 | -include_once __DIR__ . '/PolyfillTestCase.php'; |
|
| 8 | +include_once __DIR__.'/PolyfillTestCase.php'; |
|
| 9 | 9 | |
| 10 | 10 | use PHPUnit\Extensions\SeleniumCommon\RemoteCoverage; |
| 11 | 11 | use PHPUnit\Framework\TestResult; |
@@ -42,7 +42,7 @@ discard block |
||
| 42 | 42 | // (but only if not called from subclass objects / multitests) |
| 43 | 43 | if (function_exists('debug_backtrace') && strtolower(get_called_class()) == 'localhosttests') { |
| 44 | 44 | $trace = debug_backtrace(DEBUG_BACKTRACE_IGNORE_ARGS); |
| 45 | - for ($i = 0; $i < count($trace); $i++) { |
|
| 45 | + for ($i = 0; $i<count($trace); $i++) { |
|
| 46 | 46 | if (strpos($trace[$i]['function'], 'test') === 0) { |
| 47 | 47 | self::$failed_tests[$trace[$i]['function']] = true; |
| 48 | 48 | break; |
@@ -65,7 +65,7 @@ discard block |
||
| 65 | 65 | */ |
| 66 | 66 | public function _run($result = NULL) |
| 67 | 67 | { |
| 68 | - $this->testId = get_class($this) . '__' . $this->getName(); |
|
| 68 | + $this->testId = get_class($this).'__'.$this->getName(); |
|
| 69 | 69 | |
| 70 | 70 | if ($result === NULL) { |
| 71 | 71 | $result = $this->createResult(); |
@@ -96,7 +96,7 @@ discard block |
||
| 96 | 96 | $this->args = argParser::getArgs(); |
| 97 | 97 | |
| 98 | 98 | $server = explode(':', $this->args['HTTPSERVER']); |
| 99 | - if (count($server) > 1) { |
|
| 99 | + if (count($server)>1) { |
|
| 100 | 100 | $this->client = new xmlrpc_client($this->args['HTTPURI'], $server[0], $server[1]); |
| 101 | 101 | } else { |
| 102 | 102 | $this->client = new xmlrpc_client($this->args['HTTPURI'], $this->args['HTTPSERVER']); |
@@ -106,16 +106,16 @@ discard block |
||
| 106 | 106 | $this->client->request_compression = $this->request_compression; |
| 107 | 107 | $this->client->accepted_compression = $this->accepted_compression; |
| 108 | 108 | |
| 109 | - $this->coverageScriptUrl = 'http://' . $this->args['HTTPSERVER'] . preg_replace('|/tests/index\.php(\?.*)?|', '/tests/phpunit_coverage.php', $this->args['HTTPURI']); |
|
| 109 | + $this->coverageScriptUrl = 'http://'.$this->args['HTTPSERVER'].preg_replace('|/tests/index\.php(\?.*)?|', '/tests/phpunit_coverage.php', $this->args['HTTPURI']); |
|
| 110 | 110 | |
| 111 | 111 | // in debug mode, the client will be very verbose. Avoid showing its output unless there are errors |
| 112 | - if ($this->args['DEBUG'] >= 1) |
|
| 112 | + if ($this->args['DEBUG']>=1) |
|
| 113 | 113 | ob_start(); |
| 114 | 114 | } |
| 115 | 115 | |
| 116 | 116 | protected function tear_down() |
| 117 | 117 | { |
| 118 | - if ($this->args['DEBUG'] < 1) |
|
| 118 | + if ($this->args['DEBUG']<1) |
|
| 119 | 119 | return; |
| 120 | 120 | $out = ob_get_clean(); |
| 121 | 121 | $status = $this->getStatus(); |
@@ -144,9 +144,9 @@ discard block |
||
| 144 | 144 | } |
| 145 | 145 | $this->validateResponse($r); |
| 146 | 146 | if (is_array($errorCode)) { |
| 147 | - $this->assertContains($r->faultCode(), $errorCode, 'Error ' . $r->faultCode() . ' connecting to server: ' . $r->faultString()); |
|
| 147 | + $this->assertContains($r->faultCode(), $errorCode, 'Error '.$r->faultCode().' connecting to server: '.$r->faultString()); |
|
| 148 | 148 | } else { |
| 149 | - $this->assertEquals($errorCode, $r->faultCode(), 'Error ' . $r->faultCode() . ' connecting to server: ' . $r->faultString()); |
|
| 149 | + $this->assertEquals($errorCode, $r->faultCode(), 'Error '.$r->faultCode().' connecting to server: '.$r->faultString()); |
|
| 150 | 150 | } |
| 151 | 151 | if (!$r->faultCode()) { |
| 152 | 152 | if ($returnResponse) { |
@@ -173,20 +173,20 @@ discard block |
||
| 173 | 173 | $query = parse_url($this->client->path, PHP_URL_QUERY); |
| 174 | 174 | parse_str($query, $vars); |
| 175 | 175 | $query = http_build_query(array_merge($vars, $data)); |
| 176 | - $this->client->path = parse_url($this->client->path, PHP_URL_PATH) . '?' . $query; |
|
| 176 | + $this->client->path = parse_url($this->client->path, PHP_URL_PATH).'?'.$query; |
|
| 177 | 177 | } |
| 178 | 178 | |
| 179 | 179 | public function testString() |
| 180 | 180 | { |
| 181 | - $sendString = "here are 3 \"entities\": < > & " . |
|
| 182 | - "and here's a dollar sign: \$pretendvarname and a backslash too: " . chr(92) . |
|
| 183 | - " - isn't that great? \\\"hackery\\\" at it's best " . |
|
| 184 | - " also don't want to miss out on \$item[0]. " . |
|
| 185 | - "The real weird stuff follows: CRLF here" . chr(13) . chr(10) . |
|
| 186 | - "a simple CR here" . chr(13) . |
|
| 187 | - "a simple LF here" . chr(10) . |
|
| 188 | - "and then LFCR" . chr(10) . chr(13) . |
|
| 189 | - "last but not least weird names: G" . chr(252) . "nter, El" . chr(232) . "ne, and an xml comment closing tag: -->"; |
|
| 181 | + $sendString = "here are 3 \"entities\": < > & ". |
|
| 182 | + "and here's a dollar sign: \$pretendvarname and a backslash too: ".chr(92). |
|
| 183 | + " - isn't that great? \\\"hackery\\\" at it's best ". |
|
| 184 | + " also don't want to miss out on \$item[0]. ". |
|
| 185 | + "The real weird stuff follows: CRLF here".chr(13).chr(10). |
|
| 186 | + "a simple CR here".chr(13). |
|
| 187 | + "a simple LF here".chr(10). |
|
| 188 | + "and then LFCR".chr(10).chr(13). |
|
| 189 | + "last but not least weird names: G".chr(252)."nter, El".chr(232)."ne, and an xml comment closing tag: -->"; |
|
| 190 | 190 | $m = new xmlrpcmsg('examples.stringecho', array( |
| 191 | 191 | new xmlrpcval($sendString, 'string'), |
| 192 | 192 | )); |
@@ -207,7 +207,7 @@ discard block |
||
| 207 | 207 | public function testLatin1String() |
| 208 | 208 | { |
| 209 | 209 | $sendString = |
| 210 | - "last but not least weird names: G" . chr(252) . "nter, El" . chr(232) . "ne"; |
|
| 210 | + "last but not least weird names: G".chr(252)."nter, El".chr(232)."ne"; |
|
| 211 | 211 | $x = '<?xml version="1.0" encoding="ISO-8859-1"?><methodCall><methodName>examples.stringecho</methodName><params><param><value>'. |
| 212 | 212 | $sendString. |
| 213 | 213 | '</value></param></params></methodCall>'; |
@@ -316,7 +316,7 @@ discard block |
||
| 316 | 316 | public function testUtf8Method() |
| 317 | 317 | { |
| 318 | 318 | PhpXmlRpc\PhpXmlRpc::$xmlrpc_internalencoding = 'UTF-8'; |
| 319 | - $m = new xmlrpcmsg("tests.utf8methodname." . 'κόσμε', array( |
|
| 319 | + $m = new xmlrpcmsg("tests.utf8methodname.".'κόσμε', array( |
|
| 320 | 320 | new xmlrpcval('hello') |
| 321 | 321 | )); |
| 322 | 322 | $v = $this->send($m); |
@@ -338,7 +338,7 @@ discard block |
||
| 338 | 338 | )); |
| 339 | 339 | $v = $this->send($m); |
| 340 | 340 | if ($v) { |
| 341 | - $this->assertEquals($a + $b, $v->scalarval()); |
|
| 341 | + $this->assertEquals($a+$b, $v->scalarval()); |
|
| 342 | 342 | } |
| 343 | 343 | } |
| 344 | 344 | |
@@ -350,7 +350,7 @@ discard block |
||
| 350 | 350 | )); |
| 351 | 351 | $v = $this->send($m); |
| 352 | 352 | if ($v) { |
| 353 | - $this->assertEquals(12 - 23, $v->scalarval()); |
|
| 353 | + $this->assertEquals(12-23, $v->scalarval()); |
|
| 354 | 354 | } |
| 355 | 355 | } |
| 356 | 356 | |
@@ -389,7 +389,7 @@ discard block |
||
| 389 | 389 | if ($v) { |
| 390 | 390 | $sz = $v->arraysize(); |
| 391 | 391 | $got = ''; |
| 392 | - for ($i = 0; $i < $sz; $i++) { |
|
| 392 | + for ($i = 0; $i<$sz; $i++) { |
|
| 393 | 393 | $b = $v->arraymem($i); |
| 394 | 394 | if ($b->scalarval()) { |
| 395 | 395 | $got .= '1'; |
@@ -452,7 +452,7 @@ discard block |
||
| 452 | 452 | $got = ''; |
| 453 | 453 | $expected = '37210'; |
| 454 | 454 | $expect_array = array('ctLeftAngleBrackets', 'ctRightAngleBrackets', 'ctAmpersands', 'ctApostrophes', 'ctQuotes'); |
| 455 | - foreach($expect_array as $val) { |
|
| 455 | + foreach ($expect_array as $val) { |
|
| 456 | 456 | $b = $v->structmem($val); |
| 457 | 457 | $got .= $b->me['int']; |
| 458 | 458 | } |
@@ -947,7 +947,7 @@ discard block |
||
| 947 | 947 | { |
| 948 | 948 | // make a 'deep client copy' as the original one might have many properties set |
| 949 | 949 | // also for speed only wrap one method of the whole server |
| 950 | - $class = wrap_xmlrpc_server($this->client, array('simple_client_copy' => 0, 'method_filter' => '/examples\.getStateName/' )); |
|
| 950 | + $class = wrap_xmlrpc_server($this->client, array('simple_client_copy' => 0, 'method_filter' => '/examples\.getStateName/')); |
|
| 951 | 951 | if ($class == '') { |
| 952 | 952 | $this->fail('Registration of remote server failed'); |
| 953 | 953 | } else { |
@@ -986,9 +986,9 @@ discard block |
||
| 986 | 986 | $cookies = array( |
| 987 | 987 | //'c1' => array(), |
| 988 | 988 | 'c2' => array('value' => 'c2'), |
| 989 | - 'c3' => array('value' => 'c3', 'expires' => time() + 60 * 60 * 24 * 30), |
|
| 990 | - 'c4' => array('value' => 'c4', 'expires' => time() + 60 * 60 * 24 * 30, 'path' => '/'), |
|
| 991 | - 'c5' => array('value' => 'c5', 'expires' => time() + 60 * 60 * 24 * 30, 'path' => '/', 'domain' => 'localhost'), |
|
| 989 | + 'c3' => array('value' => 'c3', 'expires' => time()+60 * 60 * 24 * 30), |
|
| 990 | + 'c4' => array('value' => 'c4', 'expires' => time()+60 * 60 * 24 * 30, 'path' => '/'), |
|
| 991 | + 'c5' => array('value' => 'c5', 'expires' => time()+60 * 60 * 24 * 30, 'path' => '/', 'domain' => 'localhost'), |
|
| 992 | 992 | ); |
| 993 | 993 | $cookiesval = php_xmlrpc_encode($cookies); |
| 994 | 994 | $m = new xmlrpcmsg('tests.setcookies', array($cookiesval)); |
@@ -1036,10 +1036,10 @@ discard block |
||
| 1036 | 1036 | $m = new xmlrpcmsg('tests.getcookies', array()); |
| 1037 | 1037 | foreach ($cookies as $cookie => $val) { |
| 1038 | 1038 | $this->client->setCookie($cookie, $val); |
| 1039 | - $cookies[$cookie] = (string)$cookies[$cookie]; |
|
| 1039 | + $cookies[$cookie] = (string) $cookies[$cookie]; |
|
| 1040 | 1040 | } |
| 1041 | 1041 | $r = $this->client->send($m, $this->timeout, $this->method); |
| 1042 | - $this->assertEquals(0, $r->faultCode(), 'Error ' . $r->faultCode() . ' connecting to server: ' . $r->faultString()); |
|
| 1042 | + $this->assertEquals(0, $r->faultCode(), 'Error '.$r->faultCode().' connecting to server: '.$r->faultString()); |
|
| 1043 | 1043 | if (!$r->faultCode()) { |
| 1044 | 1044 | $v = $r->value(); |
| 1045 | 1045 | $v = php_xmlrpc_decode($v); |
@@ -109,14 +109,16 @@ |
||
| 109 | 109 | $this->coverageScriptUrl = 'http://' . $this->args['HTTPSERVER'] . preg_replace('|/tests/index\.php(\?.*)?|', '/tests/phpunit_coverage.php', $this->args['HTTPURI']); |
| 110 | 110 | |
| 111 | 111 | // in debug mode, the client will be very verbose. Avoid showing its output unless there are errors |
| 112 | - if ($this->args['DEBUG'] >= 1) |
|
| 113 | - ob_start(); |
|
| 112 | + if ($this->args['DEBUG'] >= 1) { |
|
| 113 | + ob_start(); |
|
| 114 | + } |
|
| 114 | 115 | } |
| 115 | 116 | |
| 116 | 117 | protected function tear_down() |
| 117 | 118 | { |
| 118 | - if ($this->args['DEBUG'] < 1) |
|
| 119 | - return; |
|
| 119 | + if ($this->args['DEBUG'] < 1) { |
|
| 120 | + return; |
|
| 121 | + } |
|
| 120 | 122 | $out = ob_get_clean(); |
| 121 | 123 | $status = $this->getStatus(); |
| 122 | 124 | if ($status == BaseTestRunner::STATUS_ERROR |
@@ -1,11 +1,11 @@ discard block |
||
| 1 | 1 | <?php |
| 2 | 2 | |
| 3 | -include_once __DIR__ . '/../lib/xmlrpc.inc'; |
|
| 4 | -include_once __DIR__ . '/../lib/xmlrpcs.inc'; |
|
| 3 | +include_once __DIR__.'/../lib/xmlrpc.inc'; |
|
| 4 | +include_once __DIR__.'/../lib/xmlrpcs.inc'; |
|
| 5 | 5 | |
| 6 | -include_once __DIR__ . '/parse_args.php'; |
|
| 6 | +include_once __DIR__.'/parse_args.php'; |
|
| 7 | 7 | |
| 8 | -include_once __DIR__ . '/PolyfillTestCase.php'; |
|
| 8 | +include_once __DIR__.'/PolyfillTestCase.php'; |
|
| 9 | 9 | |
| 10 | 10 | use PHPUnit\Runner\BaseTestRunner; |
| 11 | 11 | |
@@ -22,13 +22,13 @@ discard block |
||
| 22 | 22 | { |
| 23 | 23 | $this->args = argParser::getArgs(); |
| 24 | 24 | // hide parsing errors unless in debug mode |
| 25 | - if ($this->args['DEBUG'] < 1) |
|
| 25 | + if ($this->args['DEBUG']<1) |
|
| 26 | 26 | ob_start(); |
| 27 | 27 | } |
| 28 | 28 | |
| 29 | 29 | protected function tear_down() |
| 30 | 30 | { |
| 31 | - if ($this->args['DEBUG'] >= 1) |
|
| 31 | + if ($this->args['DEBUG']>=1) |
|
| 32 | 32 | return; |
| 33 | 33 | $out = ob_get_clean(); |
| 34 | 34 | $status = $this->getStatus(); |
@@ -130,7 +130,7 @@ discard block |
||
| 130 | 130 | |
| 131 | 131 | public function testI8() |
| 132 | 132 | { |
| 133 | - if (PHP_INT_SIZE == 4 ) { |
|
| 133 | + if (PHP_INT_SIZE == 4) { |
|
| 134 | 134 | $this->markTestSkipped('Can not test i8 as php is compiled in 32 bit mode'); |
| 135 | 135 | return; |
| 136 | 136 | } |
@@ -205,7 +205,7 @@ discard block |
||
| 205 | 205 | |
| 206 | 206 | public function testUnicodeInMemberName() |
| 207 | 207 | { |
| 208 | - $str = "G" . chr(252) . "nter, El" . chr(232) . "ne"; |
|
| 208 | + $str = "G".chr(252)."nter, El".chr(232)."ne"; |
|
| 209 | 209 | $v = array($str => new xmlrpcval(1)); |
| 210 | 210 | $r = new xmlrpcresp(new xmlrpcval($v, 'struct')); |
| 211 | 211 | $r = $r->serialize(); |
@@ -221,7 +221,7 @@ discard block |
||
| 221 | 221 | $response = @utf8_encode( |
| 222 | 222 | '<?xml version="1.0"?> |
| 223 | 223 | <!-- covers what happens when lib receives UTF8 chars in response text and comments --> |
| 224 | -<!-- ' . chr(224) . chr(252) . chr(232) . 'àüè --> |
|
| 224 | +<!-- ' . chr(224).chr(252).chr(232).'àüè --> |
|
| 225 | 225 | <methodResponse> |
| 226 | 226 | <fault> |
| 227 | 227 | <value> |
@@ -232,7 +232,7 @@ discard block |
||
| 232 | 232 | </member> |
| 233 | 233 | <member> |
| 234 | 234 | <name>faultString</name> |
| 235 | -<value><string>' . chr(224) . chr(252) . chr(232) . 'àüè</string></value> |
|
| 235 | +<value><string>' . chr(224).chr(252).chr(232).'àüè</string></value> |
|
| 236 | 236 | </member> |
| 237 | 237 | </struct> |
| 238 | 238 | </value> |
@@ -241,7 +241,7 @@ discard block |
||
| 241 | 241 | $m = $this->newRequest('dummy'); |
| 242 | 242 | $r = $m->parseResponse($response); |
| 243 | 243 | $v = $r->faultString(); |
| 244 | - $this->assertEquals(chr(224) . chr(252) . chr(232) . chr(224) . chr(252) . chr(232), $v); |
|
| 244 | + $this->assertEquals(chr(224).chr(252).chr(232).chr(224).chr(252).chr(232), $v); |
|
| 245 | 245 | } |
| 246 | 246 | |
| 247 | 247 | public function testBrokenRequests() |
@@ -448,8 +448,8 @@ discard block |
||
| 448 | 448 | $i = \PhpXmlRpc\PhpXmlRpc::$xmlrpc_reject_invalid_values; |
| 449 | 449 | \PhpXmlRpc\PhpXmlRpc::$xmlrpc_reject_invalid_values = true; |
| 450 | 450 | |
| 451 | - foreach($values as $value) { |
|
| 452 | - $f = '<?xml version="1.0"?><methodResponse><params><param><value>' . $value . '</value></param></params></methodResponse> '; |
|
| 451 | + foreach ($values as $value) { |
|
| 452 | + $f = '<?xml version="1.0"?><methodResponse><params><param><value>'.$value.'</value></param></params></methodResponse> '; |
|
| 453 | 453 | $r = $s->parseResponse($f); |
| 454 | 454 | $v = $r->faultCode(); |
| 455 | 455 | $this->assertEquals(2, $v, "Testing $value"); |
@@ -553,11 +553,11 @@ discard block |
||
| 553 | 553 | |
| 554 | 554 | public function testUTF8Response() |
| 555 | 555 | { |
| 556 | - $string = chr(224) . chr(252) . chr(232); |
|
| 556 | + $string = chr(224).chr(252).chr(232); |
|
| 557 | 557 | |
| 558 | 558 | $s = $this->newRequest('dummy'); |
| 559 | - $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> |
|
| 560 | -<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> |
|
| 559 | + $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> |
|
| 560 | +<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> |
|
| 561 | 561 | '; |
| 562 | 562 | $r = $s->parseResponse($f, false, 'phpvals'); |
| 563 | 563 | $v = $r->value(); |
@@ -565,7 +565,7 @@ discard block |
||
| 565 | 565 | $this->assertEquals($string, $v); |
| 566 | 566 | |
| 567 | 567 | $f = '<?xml version="1.0" encoding="UTF-8"?><methodResponse><params><param><value><struct><member><name>userid</name><value>311127</value></member> |
| 568 | -<member><name>dateCreated</name><value><dateTime.iso8601>20011126T09:17:52</dateTime.iso8601></value></member><member><name>content</name><value>' . @utf8_encode($string) . '</value></member><member><name>postid</name><value>7414222</value></member></struct></value></param></params></methodResponse> |
|
| 568 | +<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> |
|
| 569 | 569 | '; |
| 570 | 570 | $r = $s->parseResponse($f, false, 'phpvals'); |
| 571 | 571 | $v = $r->value(); |
@@ -581,11 +581,11 @@ discard block |
||
| 581 | 581 | |
| 582 | 582 | public function testLatin1Response() |
| 583 | 583 | { |
| 584 | - $string = chr(224) . chr(252) . chr(232); |
|
| 584 | + $string = chr(224).chr(252).chr(232); |
|
| 585 | 585 | |
| 586 | 586 | $s = $this->newRequest('dummy'); |
| 587 | - $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> |
|
| 588 | -<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> |
|
| 587 | + $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> |
|
| 588 | +<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> |
|
| 589 | 589 | '; |
| 590 | 590 | $r = $s->parseResponse($f, false, 'phpvals'); |
| 591 | 591 | $v = $r->value(); |
@@ -593,7 +593,7 @@ discard block |
||
| 593 | 593 | $this->assertEquals($string, $v); |
| 594 | 594 | |
| 595 | 595 | $f = '<?xml version="1.0" encoding="ISO-8859-1"?><methodResponse><params><param><value><struct><member><name>userid</name><value>311127</value></member> |
| 596 | -<member><name>dateCreated</name><value><dateTime.iso8601>20011126T09:17:52</dateTime.iso8601></value></member><member><name>content</name><value>' . $string . '</value></member><member><name>postid</name><value>7414222</value></member></struct></value></param></params></methodResponse> |
|
| 596 | +<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> |
|
| 597 | 597 | '; |
| 598 | 598 | $r = $s->parseResponse($f, false, 'phpvals'); |
| 599 | 599 | $v = $r->value(); |
@@ -22,14 +22,16 @@ |
||
| 22 | 22 | { |
| 23 | 23 | $this->args = argParser::getArgs(); |
| 24 | 24 | // hide parsing errors unless in debug mode |
| 25 | - if ($this->args['DEBUG'] < 1) |
|
| 26 | - ob_start(); |
|
| 25 | + if ($this->args['DEBUG'] < 1) { |
|
| 26 | + ob_start(); |
|
| 27 | + } |
|
| 27 | 28 | } |
| 28 | 29 | |
| 29 | 30 | protected function tear_down() |
| 30 | 31 | { |
| 31 | - if ($this->args['DEBUG'] >= 1) |
|
| 32 | - return; |
|
| 32 | + if ($this->args['DEBUG'] >= 1) { |
|
| 33 | + return; |
|
| 34 | + } |
|
| 33 | 35 | $out = ob_get_clean(); |
| 34 | 36 | $status = $this->getStatus(); |
| 35 | 37 | if ($status == BaseTestRunner::STATUS_ERROR |
@@ -91,14 +91,14 @@ discard block |
||
| 91 | 91 | if (count($this->xml_iso88591_Entities['in'])) { |
| 92 | 92 | return; |
| 93 | 93 | } |
| 94 | - for ($i = 0; $i < 32; $i++) { |
|
| 94 | + for ($i = 0; $i<32; $i++) { |
|
| 95 | 95 | $this->xml_iso88591_Entities["in"][] = chr($i); |
| 96 | 96 | $this->xml_iso88591_Entities["out"][] = "&#{$i};"; |
| 97 | 97 | } |
| 98 | 98 | |
| 99 | 99 | /// @todo to be 'print safe', should we encode as well character 127 (DEL) ? |
| 100 | 100 | |
| 101 | - for ($i = 160; $i < 256; $i++) { |
|
| 101 | + for ($i = 160; $i<256; $i++) { |
|
| 102 | 102 | $this->xml_iso88591_Entities["in"][] = chr($i); |
| 103 | 103 | $this->xml_iso88591_Entities["out"][] = "&#{$i};"; |
| 104 | 104 | } |
@@ -126,7 +126,7 @@ discard block |
||
| 126 | 126 | break;*/ |
| 127 | 127 | |
| 128 | 128 | default: |
| 129 | - throw new \Exception('Unsupported table: ' . $tableName); |
|
| 129 | + throw new \Exception('Unsupported table: '.$tableName); |
|
| 130 | 130 | } |
| 131 | 131 | } |
| 132 | 132 | |
@@ -178,7 +178,7 @@ discard block |
||
| 178 | 178 | $srcEncoding = 'UTF-8'; |
| 179 | 179 | } |
| 180 | 180 | |
| 181 | - $conversion = strtoupper($srcEncoding . '_' . $destEncoding); |
|
| 181 | + $conversion = strtoupper($srcEncoding.'_'.$destEncoding); |
|
| 182 | 182 | |
| 183 | 183 | // list ordered with (expected) most common scenarios first |
| 184 | 184 | switch ($conversion) { |
@@ -196,20 +196,20 @@ discard block |
||
| 196 | 196 | // NB: this will choke on invalid UTF-8, going most likely beyond EOF |
| 197 | 197 | $escapedData = ''; |
| 198 | 198 | // be kind to users creating string xml-rpc values out of different php types |
| 199 | - $data = (string)$data; |
|
| 199 | + $data = (string) $data; |
|
| 200 | 200 | $ns = strlen($data); |
| 201 | - for ($nn = 0; $nn < $ns; $nn++) { |
|
| 201 | + for ($nn = 0; $nn<$ns; $nn++) { |
|
| 202 | 202 | $ch = $data[$nn]; |
| 203 | 203 | $ii = ord($ch); |
| 204 | 204 | // 7 bits in 1 byte: 0bbbbbbb (127) |
| 205 | - if ($ii < 32) { |
|
| 205 | + if ($ii<32) { |
|
| 206 | 206 | if ($conversion == 'UTF-8_US-ASCII') { |
| 207 | 207 | $escapedData .= sprintf('&#%d;', $ii); |
| 208 | 208 | } else { |
| 209 | 209 | $escapedData .= $ch; |
| 210 | 210 | } |
| 211 | 211 | } |
| 212 | - else if ($ii < 128) { |
|
| 212 | + else if ($ii<128) { |
|
| 213 | 213 | /// @todo shall we replace this with a (supposedly) faster str_replace? |
| 214 | 214 | /// @todo to be 'print safe', should we encode as well character 127 (DEL) ? |
| 215 | 215 | switch ($ii) { |
@@ -234,25 +234,25 @@ discard block |
||
| 234 | 234 | } // 11 bits in 2 bytes: 110bbbbb 10bbbbbb (2047) |
| 235 | 235 | elseif ($ii >> 5 == 6) { |
| 236 | 236 | $b1 = ($ii & 31); |
| 237 | - $b2 = (ord($data[$nn + 1]) & 63); |
|
| 238 | - $ii = ($b1 * 64) + $b2; |
|
| 237 | + $b2 = (ord($data[$nn+1]) & 63); |
|
| 238 | + $ii = ($b1 * 64)+$b2; |
|
| 239 | 239 | $escapedData .= sprintf('&#%d;', $ii); |
| 240 | 240 | $nn += 1; |
| 241 | 241 | } // 16 bits in 3 bytes: 1110bbbb 10bbbbbb 10bbbbbb |
| 242 | 242 | elseif ($ii >> 4 == 14) { |
| 243 | 243 | $b1 = ($ii & 15); |
| 244 | - $b2 = (ord($data[$nn + 1]) & 63); |
|
| 245 | - $b3 = (ord($data[$nn + 2]) & 63); |
|
| 246 | - $ii = ((($b1 * 64) + $b2) * 64) + $b3; |
|
| 244 | + $b2 = (ord($data[$nn+1]) & 63); |
|
| 245 | + $b3 = (ord($data[$nn+2]) & 63); |
|
| 246 | + $ii = ((($b1 * 64)+$b2) * 64)+$b3; |
|
| 247 | 247 | $escapedData .= sprintf('&#%d;', $ii); |
| 248 | 248 | $nn += 2; |
| 249 | 249 | } // 21 bits in 4 bytes: 11110bbb 10bbbbbb 10bbbbbb 10bbbbbb |
| 250 | 250 | elseif ($ii >> 3 == 30) { |
| 251 | 251 | $b1 = ($ii & 7); |
| 252 | - $b2 = (ord($data[$nn + 1]) & 63); |
|
| 253 | - $b3 = (ord($data[$nn + 2]) & 63); |
|
| 254 | - $b4 = (ord($data[$nn + 3]) & 63); |
|
| 255 | - $ii = ((((($b1 * 64) + $b2) * 64) + $b3) * 64) + $b4; |
|
| 252 | + $b2 = (ord($data[$nn+1]) & 63); |
|
| 253 | + $b3 = (ord($data[$nn+2]) & 63); |
|
| 254 | + $b4 = (ord($data[$nn+3]) & 63); |
|
| 255 | + $ii = ((((($b1 * 64)+$b2) * 64)+$b3) * 64)+$b4; |
|
| 256 | 256 | $escapedData .= sprintf('&#%d;', $ii); |
| 257 | 257 | $nn += 3; |
| 258 | 258 | } |
@@ -305,14 +305,14 @@ discard block |
||
| 305 | 305 | // If src is UTF8, we run htmlspecialchars before converting to the target charset, as |
| 306 | 306 | // htmlspecialchars has limited charset support, but it groks utf8 |
| 307 | 307 | if ($srcEncoding === 'UTF-8') { |
| 308 | - $data = htmlspecialchars($data, defined('ENT_XML1') ? ENT_XML1 | ENT_QUOTES : ENT_QUOTES, 'UTF-8'); |
|
| 308 | + $data = htmlspecialchars($data, defined('ENT_XML1') ? ENT_XML1 | ENT_QUOTES : ENT_QUOTES, 'UTF-8'); |
|
| 309 | 309 | } |
| 310 | 310 | if ($srcEncoding !== $destEncoding) { |
| 311 | 311 | $data = @mb_convert_encoding($data, str_replace('US-ASCII', 'ASCII', $destEncoding), str_replace('US-ASCII', 'ASCII', $srcEncoding)); |
| 312 | 312 | } |
| 313 | 313 | if ($data === false) { |
| 314 | 314 | $escapedData = ''; |
| 315 | - $this->getLogger()->errorLog('XML-RPC: ' . __METHOD__ . ": Converting from $srcEncoding to $destEncoding via mbstring: failed..."); |
|
| 315 | + $this->getLogger()->errorLog('XML-RPC: '.__METHOD__.": Converting from $srcEncoding to $destEncoding via mbstring: failed..."); |
|
| 316 | 316 | } else { |
| 317 | 317 | if ($srcEncoding === 'UTF-8') { |
| 318 | 318 | $escapedData = $data; |
@@ -322,7 +322,7 @@ discard block |
||
| 322 | 322 | } |
| 323 | 323 | } else { |
| 324 | 324 | $escapedData = ''; |
| 325 | - $this->getLogger()->errorLog('XML-RPC: ' . __METHOD__ . ": Converting from $srcEncoding to $destEncoding: not supported..."); |
|
| 325 | + $this->getLogger()->errorLog('XML-RPC: '.__METHOD__.": Converting from $srcEncoding to $destEncoding: not supported..."); |
|
| 326 | 326 | } |
| 327 | 327 | } |
| 328 | 328 | |
@@ -340,7 +340,7 @@ discard block |
||
| 340 | 340 | if (function_exists('mb_list_encodings')) { |
| 341 | 341 | $knownCharsets = array_unique(array_merge($knownCharsets, array_diff(mb_list_encodings(), array( |
| 342 | 342 | 'pass', 'auto', 'wchar', 'BASE64', 'UUENCODE', 'ASCII', 'HTML-ENTITIES', 'Quoted-Printable', |
| 343 | - '7bit','8bit', 'byte2be', 'byte2le', 'byte4be', 'byte4le' |
|
| 343 | + '7bit', '8bit', 'byte2be', 'byte2le', 'byte4be', 'byte4le' |
|
| 344 | 344 | )))); |
| 345 | 345 | } |
| 346 | 346 | return $knownCharsets; |
@@ -394,7 +394,7 @@ discard block |
||
| 394 | 394 | case 'iso88591': |
| 395 | 395 | return $this->xml_iso88591_Entities; |
| 396 | 396 | default: |
| 397 | - throw new \Exception('Unsupported charset: ' . $charset); |
|
| 397 | + throw new \Exception('Unsupported charset: '.$charset); |
|
| 398 | 398 | } |
| 399 | 399 | } |
| 400 | 400 | } |
@@ -185,12 +185,12 @@ discard block |
||
| 185 | 185 | foreach ($mergedOptions as $key => $val) { |
| 186 | 186 | // q: can php be built without ctype? should we use a regexp? |
| 187 | 187 | if (is_string($key) && !ctype_digit($key)) { |
| 188 | - switch($key) { |
|
| 188 | + switch ($key) { |
|
| 189 | 189 | case 'target_charset': |
| 190 | 190 | if (function_exists('mb_convert_encoding')) { |
| 191 | 191 | $this->current_parsing_options['target_charset'] = $val; |
| 192 | 192 | } else { |
| 193 | - $this->getLogger()->errorLog('XML-RPC: ' . __METHOD__ . ": 'target_charset' option is unsupported without mbstring"); |
|
| 193 | + $this->getLogger()->errorLog('XML-RPC: '.__METHOD__.": 'target_charset' option is unsupported without mbstring"); |
|
| 194 | 194 | } |
| 195 | 195 | break; |
| 196 | 196 | |
@@ -201,7 +201,7 @@ discard block |
||
| 201 | 201 | //$this->_xh['isf'] = 4; |
| 202 | 202 | //$this->_xh['isf_reason'] = "Callback passed as 'methodname_callback' is not callable"; |
| 203 | 203 | //return; |
| 204 | - $this->getLogger()->errorLog('XML-RPC: ' . __METHOD__ . ": Callback passed as 'methodname_callback' is not callable"); |
|
| 204 | + $this->getLogger()->errorLog('XML-RPC: '.__METHOD__.": Callback passed as 'methodname_callback' is not callable"); |
|
| 205 | 205 | } |
| 206 | 206 | break; |
| 207 | 207 | |
@@ -212,7 +212,7 @@ discard block |
||
| 212 | 212 | break; |
| 213 | 213 | |
| 214 | 214 | default: |
| 215 | - $this->getLogger()->errorLog('XML-RPC: ' . __METHOD__ . ": unsupported option: $key"); |
|
| 215 | + $this->getLogger()->errorLog('XML-RPC: '.__METHOD__.": unsupported option: $key"); |
|
| 216 | 216 | } |
| 217 | 217 | unset($mergedOptions[$key]); |
| 218 | 218 | } |
@@ -258,10 +258,10 @@ discard block |
||
| 258 | 258 | |
| 259 | 259 | try { |
| 260 | 260 | // @see ticket #70 - we have to parse big xml docs in chunks to avoid errors |
| 261 | - for ($offset = 0; $offset < $len; $offset += $this->maxChunkLength) { |
|
| 261 | + for ($offset = 0; $offset<$len; $offset += $this->maxChunkLength) { |
|
| 262 | 262 | $chunk = substr($data, $offset, $this->maxChunkLength); |
| 263 | 263 | // error handling: xml not well formed |
| 264 | - if (!xml_parse($parser, $chunk, $offset + $this->maxChunkLength >= $len)) { |
|
| 264 | + if (!xml_parse($parser, $chunk, $offset+$this->maxChunkLength>=$len)) { |
|
| 265 | 265 | $errCode = xml_get_error_code($parser); |
| 266 | 266 | $errStr = sprintf('XML error %s: %s at line %d, column %d', $errCode, xml_error_string($errCode), |
| 267 | 267 | xml_get_current_line_number($parser), xml_get_current_column_number($parser)); |
@@ -271,7 +271,7 @@ discard block |
||
| 271 | 271 | break; |
| 272 | 272 | } |
| 273 | 273 | // no need to parse further if we already have a fatal error |
| 274 | - if ($this->_xh['isf'] >= 2) { |
|
| 274 | + if ($this->_xh['isf']>=2) { |
|
| 275 | 275 | break; |
| 276 | 276 | } |
| 277 | 277 | } |
@@ -303,7 +303,7 @@ discard block |
||
| 303 | 303 | public function xmlrpc_se($parser, $name, $attrs, $acceptSingleVals = false) |
| 304 | 304 | { |
| 305 | 305 | // if invalid xml-rpc already detected, skip all processing |
| 306 | - if ($this->_xh['isf'] >= 2) { |
|
| 306 | + if ($this->_xh['isf']>=2) { |
|
| 307 | 307 | return; |
| 308 | 308 | } |
| 309 | 309 | |
@@ -326,7 +326,7 @@ discard block |
||
| 326 | 326 | $this->_xh['rt'] = strtolower($name); |
| 327 | 327 | } else { |
| 328 | 328 | $this->_xh['isf'] = 2; |
| 329 | - $this->_xh['isf_reason'] = 'missing top level xmlrpc element. Found: ' . $name; |
|
| 329 | + $this->_xh['isf_reason'] = 'missing top level xmlrpc element. Found: '.$name; |
|
| 330 | 330 | |
| 331 | 331 | return; |
| 332 | 332 | } |
@@ -428,7 +428,7 @@ discard block |
||
| 428 | 428 | |
| 429 | 429 | case 'MEMBER': |
| 430 | 430 | // set member name to null, in case we do not find in the xml later on |
| 431 | - $this->_xh['valuestack'][count($this->_xh['valuestack']) - 1]['name'] = null; |
|
| 431 | + $this->_xh['valuestack'][count($this->_xh['valuestack'])-1]['name'] = null; |
|
| 432 | 432 | //$this->_xh['ac']=''; |
| 433 | 433 | // Drop trough intentionally |
| 434 | 434 | |
@@ -500,7 +500,7 @@ discard block |
||
| 500 | 500 | */ |
| 501 | 501 | public function xmlrpc_ee($parser, $name, $rebuildXmlrpcvals = 1) |
| 502 | 502 | { |
| 503 | - if ($this->_xh['isf'] >= 2) { |
|
| 503 | + if ($this->_xh['isf']>=2) { |
|
| 504 | 504 | return; |
| 505 | 505 | |
| 506 | 506 | } |
@@ -522,7 +522,7 @@ discard block |
||
| 522 | 522 | $this->_xh['value'] = mb_convert_encoding($this->_xh['value'], $this->current_parsing_options['target_charset'], 'UTF-8'); |
| 523 | 523 | } |
| 524 | 524 | |
| 525 | - if ($rebuildXmlrpcvals > 0) { |
|
| 525 | + if ($rebuildXmlrpcvals>0) { |
|
| 526 | 526 | // build the xml-rpc val out of the data received, and substitute it |
| 527 | 527 | $temp = new Value($this->_xh['value'], $this->_xh['vt']); |
| 528 | 528 | // in case we got info about underlying php class, save it in the object we're rebuilding |
@@ -530,15 +530,15 @@ discard block |
||
| 530 | 530 | $temp->_php_class = $this->_xh['php_class']; |
| 531 | 531 | } |
| 532 | 532 | $this->_xh['value'] = $temp; |
| 533 | - } elseif ($rebuildXmlrpcvals < 0) { |
|
| 533 | + } elseif ($rebuildXmlrpcvals<0) { |
|
| 534 | 534 | if ($this->_xh['vt'] == Value::$xmlrpcDateTime) { |
| 535 | - $this->_xh['value'] = (object)array( |
|
| 535 | + $this->_xh['value'] = (object) array( |
|
| 536 | 536 | 'xmlrpc_type' => 'datetime', |
| 537 | 537 | 'scalar' => $this->_xh['value'], |
| 538 | 538 | 'timestamp' => \PhpXmlRpc\Helper\Date::iso8601Decode($this->_xh['value']) |
| 539 | 539 | ); |
| 540 | 540 | } elseif ($this->_xh['vt'] == Value::$xmlrpcBase64) { |
| 541 | - $this->_xh['value'] = (object)array( |
|
| 541 | + $this->_xh['value'] = (object) array( |
|
| 542 | 542 | 'xmlrpc_type' => 'base64', |
| 543 | 543 | 'scalar' => $this->_xh['value'] |
| 544 | 544 | ); |
@@ -553,8 +553,8 @@ discard block |
||
| 553 | 553 | // check if we are inside an array or struct: |
| 554 | 554 | // if value just built is inside an array, let's move it into array on the stack |
| 555 | 555 | $vscount = count($this->_xh['valuestack']); |
| 556 | - if ($vscount && $this->_xh['valuestack'][$vscount - 1]['type'] == 'ARRAY') { |
|
| 557 | - $this->_xh['valuestack'][$vscount - 1]['values'][] = $this->_xh['value']; |
|
| 556 | + if ($vscount && $this->_xh['valuestack'][$vscount-1]['type'] == 'ARRAY') { |
|
| 557 | + $this->_xh['valuestack'][$vscount-1]['values'][] = $this->_xh['value']; |
|
| 558 | 558 | } |
| 559 | 559 | break; |
| 560 | 560 | |
@@ -583,10 +583,10 @@ discard block |
||
| 583 | 583 | if ($this->_xh['ac'] != '0' && strcasecmp($this->_xh['ac'], 'false') !== 0) { |
| 584 | 584 | if ($this->current_parsing_options['xmlrpc_reject_invalid_values']) { |
| 585 | 585 | $this->_xh['isf'] = 2; |
| 586 | - $this->_xh['isf_reason'] = 'Invalid data received in BOOLEAN value: ' . $this->_xh['ac']; |
|
| 586 | + $this->_xh['isf_reason'] = 'Invalid data received in BOOLEAN value: '.$this->_xh['ac']; |
|
| 587 | 587 | return; |
| 588 | 588 | } else { |
| 589 | - $this->getLogger()->errorLog('XML-RPC: ' . __METHOD__ . ': invalid data received in BOOLEAN value: ' . $this->_xh['ac']); |
|
| 589 | + $this->getLogger()->errorLog('XML-RPC: '.__METHOD__.': invalid data received in BOOLEAN value: '.$this->_xh['ac']); |
|
| 590 | 590 | } |
| 591 | 591 | } |
| 592 | 592 | $this->_xh['value'] = false; |
@@ -607,16 +607,16 @@ discard block |
||
| 607 | 607 | if ($this->current_parsing_options['xmlrpc_reject_invalid_values']) |
| 608 | 608 | { |
| 609 | 609 | $this->_xh['isf'] = 2; |
| 610 | - $this->_xh['isf_reason'] = 'Non numeric data received in INT value: ' . $this->_xh['ac']; |
|
| 610 | + $this->_xh['isf_reason'] = 'Non numeric data received in INT value: '.$this->_xh['ac']; |
|
| 611 | 611 | return; |
| 612 | 612 | } else { |
| 613 | - $this->getLogger()->errorLog('XML-RPC: ' . __METHOD__ . ': non numeric data received in INT: ' . $this->_xh['ac']); |
|
| 613 | + $this->getLogger()->errorLog('XML-RPC: '.__METHOD__.': non numeric data received in INT: '.$this->_xh['ac']); |
|
| 614 | 614 | } |
| 615 | 615 | /// @todo: find a better way of reporting an error value than this! Use NaN? |
| 616 | 616 | $this->_xh['value'] = 'ERROR_NON_NUMERIC_FOUND'; |
| 617 | 617 | } else { |
| 618 | 618 | // it's ok, add it on |
| 619 | - $this->_xh['value'] = (int)$this->_xh['ac']; |
|
| 619 | + $this->_xh['value'] = (int) $this->_xh['ac']; |
|
| 620 | 620 | } |
| 621 | 621 | break; |
| 622 | 622 | |
@@ -626,16 +626,16 @@ discard block |
||
| 626 | 626 | if (!preg_match(PhpXmlRpc::$xmlrpc_double_format, $this->_xh['ac'])) { |
| 627 | 627 | if ($this->current_parsing_options['xmlrpc_reject_invalid_values']) { |
| 628 | 628 | $this->_xh['isf'] = 2; |
| 629 | - $this->_xh['isf_reason'] = 'Non numeric data received in DOUBLE value: ' . $this->_xh['ac']; |
|
| 629 | + $this->_xh['isf_reason'] = 'Non numeric data received in DOUBLE value: '.$this->_xh['ac']; |
|
| 630 | 630 | return; |
| 631 | 631 | } else { |
| 632 | - $this->getLogger()->errorLog('XML-RPC: ' . __METHOD__ . ': non numeric data received in DOUBLE value: ' . $this->_xh['ac']); |
|
| 632 | + $this->getLogger()->errorLog('XML-RPC: '.__METHOD__.': non numeric data received in DOUBLE value: '.$this->_xh['ac']); |
|
| 633 | 633 | } |
| 634 | 634 | |
| 635 | 635 | $this->_xh['value'] = 'ERROR_NON_NUMERIC_FOUND'; |
| 636 | 636 | } else { |
| 637 | 637 | // it's ok, add it on |
| 638 | - $this->_xh['value'] = (double)$this->_xh['ac']; |
|
| 638 | + $this->_xh['value'] = (double) $this->_xh['ac']; |
|
| 639 | 639 | } |
| 640 | 640 | break; |
| 641 | 641 | |
@@ -645,18 +645,18 @@ discard block |
||
| 645 | 645 | if (!preg_match(PhpXmlRpc::$xmlrpc_datetime_format, $this->_xh['ac'])) { |
| 646 | 646 | if ($this->current_parsing_options['xmlrpc_reject_invalid_values']) { |
| 647 | 647 | $this->_xh['isf'] = 2; |
| 648 | - $this->_xh['isf_reason'] = 'Invalid data received in DATETIME value: ' . $this->_xh['ac']; |
|
| 648 | + $this->_xh['isf_reason'] = 'Invalid data received in DATETIME value: '.$this->_xh['ac']; |
|
| 649 | 649 | return; |
| 650 | 650 | } else { |
| 651 | - $this->getLogger()->errorLog('XML-RPC: ' . __METHOD__ . ': invalid data received in DATETIME value: ' . $this->_xh['ac']); |
|
| 651 | + $this->getLogger()->errorLog('XML-RPC: '.__METHOD__.': invalid data received in DATETIME value: '.$this->_xh['ac']); |
|
| 652 | 652 | } |
| 653 | 653 | } |
| 654 | 654 | if ($this->current_parsing_options['xmlrpc_return_datetimes']) { |
| 655 | 655 | try { |
| 656 | 656 | $this->_xh['value'] = new \DateTime($this->_xh['ac']); |
| 657 | - } catch(\Exception $e) { |
|
| 657 | + } catch (\Exception $e) { |
|
| 658 | 658 | // q: what to do? we can not guarantee that a valid date can be created. Return null or throw? |
| 659 | - $this->getLogger()->errorLog('XML-RPC: ' . __METHOD__ . ': ' . $e->getMessage()); |
|
| 659 | + $this->getLogger()->errorLog('XML-RPC: '.__METHOD__.': '.$e->getMessage()); |
|
| 660 | 660 | $this->_xh['value'] = null; |
| 661 | 661 | } |
| 662 | 662 | } else { |
@@ -678,29 +678,29 @@ discard block |
||
| 678 | 678 | $v = base64_decode($this->_xh['ac']); |
| 679 | 679 | if ($v === '' && $this->_xh['ac'] !== '') { |
| 680 | 680 | // only the empty string should decode to the empty string |
| 681 | - $this->getLogger()->errorLog('XML-RPC: ' . __METHOD__ . ': invalid data received in BASE64 value'); |
|
| 681 | + $this->getLogger()->errorLog('XML-RPC: '.__METHOD__.': invalid data received in BASE64 value'); |
|
| 682 | 682 | } |
| 683 | 683 | } |
| 684 | 684 | $this->_xh['value'] = $v; |
| 685 | 685 | break; |
| 686 | 686 | |
| 687 | 687 | case 'NAME': |
| 688 | - $this->_xh['valuestack'][count($this->_xh['valuestack']) - 1]['name'] = $this->_xh['ac']; |
|
| 688 | + $this->_xh['valuestack'][count($this->_xh['valuestack'])-1]['name'] = $this->_xh['ac']; |
|
| 689 | 689 | break; |
| 690 | 690 | |
| 691 | 691 | case 'MEMBER': |
| 692 | 692 | // add to array in the stack the last element built, unless no VALUE or no NAME were found |
| 693 | 693 | if ($this->_xh['vt']) { |
| 694 | 694 | $vscount = count($this->_xh['valuestack']); |
| 695 | - if ($this->_xh['valuestack'][$vscount - 1]['name'] === null) { |
|
| 695 | + if ($this->_xh['valuestack'][$vscount-1]['name'] === null) { |
|
| 696 | 696 | /// @todo return a parsing error if $this->current_parsing_options['xmlrpc_reject_invalid_values'] |
| 697 | - $this->getLogger()->errorLog('XML-RPC: ' . __METHOD__ . ': missing NAME inside STRUCT in received xml'); |
|
| 698 | - $this->_xh['valuestack'][$vscount - 1]['name'] = ''; |
|
| 697 | + $this->getLogger()->errorLog('XML-RPC: '.__METHOD__.': missing NAME inside STRUCT in received xml'); |
|
| 698 | + $this->_xh['valuestack'][$vscount-1]['name'] = ''; |
|
| 699 | 699 | } |
| 700 | - $this->_xh['valuestack'][$vscount - 1]['values'][$this->_xh['valuestack'][$vscount - 1]['name']] = $this->_xh['value']; |
|
| 700 | + $this->_xh['valuestack'][$vscount-1]['values'][$this->_xh['valuestack'][$vscount-1]['name']] = $this->_xh['value']; |
|
| 701 | 701 | } else { |
| 702 | 702 | /// @todo return a parsing error $this->current_parsing_options['xmlrpc_reject_invalid_values'] |
| 703 | - $this->getLogger()->errorLog('XML-RPC: ' . __METHOD__ . ': missing VALUE inside STRUCT in received xml'); |
|
| 703 | + $this->getLogger()->errorLog('XML-RPC: '.__METHOD__.': missing VALUE inside STRUCT in received xml'); |
|
| 704 | 704 | } |
| 705 | 705 | break; |
| 706 | 706 | |
@@ -726,7 +726,7 @@ discard block |
||
| 726 | 726 | $this->_xh['pt'][] = $this->_xh['vt']; |
| 727 | 727 | } else { |
| 728 | 728 | /// @todo return a parsing error when ($this->current_parsing_options['xmlrpc_reject_invalid_values']) |
| 729 | - $this->getLogger()->errorLog('XML-RPC: ' . __METHOD__ . ': missing VALUE inside PARAM in received xml'); |
|
| 729 | + $this->getLogger()->errorLog('XML-RPC: '.__METHOD__.': missing VALUE inside PARAM in received xml'); |
|
| 730 | 730 | } |
| 731 | 731 | break; |
| 732 | 732 | |
@@ -809,7 +809,7 @@ discard block |
||
| 809 | 809 | public function xmlrpc_cd($parser, $data) |
| 810 | 810 | { |
| 811 | 811 | // skip processing if xml fault already detected |
| 812 | - if ($this->_xh['isf'] >= 2) { |
|
| 812 | + if ($this->_xh['isf']>=2) { |
|
| 813 | 813 | return; |
| 814 | 814 | } |
| 815 | 815 | |
@@ -831,7 +831,7 @@ discard block |
||
| 831 | 831 | public function xmlrpc_dh($parser, $data) |
| 832 | 832 | { |
| 833 | 833 | // skip processing if xml fault already detected |
| 834 | - if ($this->_xh['isf'] >= 2) { |
|
| 834 | + if ($this->_xh['isf']>=2) { |
|
| 835 | 835 | return; |
| 836 | 836 | } |
| 837 | 837 | |
@@ -905,8 +905,8 @@ discard block |
||
| 905 | 905 | // Details: |
| 906 | 906 | // SPACE: (#x20 | #x9 | #xD | #xA)+ === [ \x9\xD\xA]+ |
| 907 | 907 | // EQ: SPACE?=SPACE? === [ \x9\xD\xA]*=[ \x9\xD\xA]* |
| 908 | - if (preg_match('/^<\?xml\s+version\s*=\s*' . "((?:\"[a-zA-Z0-9_.:-]+\")|(?:'[a-zA-Z0-9_.:-]+'))" . |
|
| 909 | - '\s+encoding\s*=\s*' . "((?:\"[A-Za-z][A-Za-z0-9._-]*\")|(?:'[A-Za-z][A-Za-z0-9._-]*'))/", |
|
| 908 | + if (preg_match('/^<\?xml\s+version\s*=\s*'."((?:\"[a-zA-Z0-9_.:-]+\")|(?:'[a-zA-Z0-9_.:-]+'))". |
|
| 909 | + '\s+encoding\s*=\s*'."((?:\"[A-Za-z][A-Za-z0-9._-]*\")|(?:'[A-Za-z][A-Za-z0-9._-]*'))/", |
|
| 910 | 910 | $xmlChunk, $matches)) { |
| 911 | 911 | return strtoupper(substr($matches[2], 1, -1)); |
| 912 | 912 | } |
@@ -924,7 +924,7 @@ discard block |
||
| 924 | 924 | // NB: mb_detect likes to call it ascii, xml parser likes to call it US_ASCII... |
| 925 | 925 | // IANA also likes better US-ASCII, so go with it |
| 926 | 926 | if ($enc == 'ASCII') { |
| 927 | - $enc = 'US-' . $enc; |
|
| 927 | + $enc = 'US-'.$enc; |
|
| 928 | 928 | } |
| 929 | 929 | |
| 930 | 930 | return $enc; |
@@ -961,8 +961,8 @@ discard block |
||
| 961 | 961 | // Details: |
| 962 | 962 | // SPACE: (#x20 | #x9 | #xD | #xA)+ === [ \x9\xD\xA]+ |
| 963 | 963 | // EQ: SPACE?=SPACE? === [ \x9\xD\xA]*=[ \x9\xD\xA]* |
| 964 | - if (preg_match('/^<\?xml\s+version\s*=\s*' . "((?:\"[a-zA-Z0-9_.:-]+\")|(?:'[a-zA-Z0-9_.:-]+'))" . |
|
| 965 | - '\s+encoding\s*=\s*' . "((?:\"[A-Za-z][A-Za-z0-9._-]*\")|(?:'[A-Za-z][A-Za-z0-9._-]*'))/", |
|
| 964 | + if (preg_match('/^<\?xml\s+version\s*=\s*'."((?:\"[a-zA-Z0-9_.:-]+\")|(?:'[a-zA-Z0-9_.:-]+'))". |
|
| 965 | + '\s+encoding\s*=\s*'."((?:\"[A-Za-z][A-Za-z0-9._-]*\")|(?:'[A-Za-z][A-Za-z0-9._-]*'))/", |
|
| 966 | 966 | $xmlChunk)) { |
| 967 | 967 | return true; |
| 968 | 968 | } |
@@ -982,7 +982,7 @@ discard block |
||
| 982 | 982 | break; |
| 983 | 983 | default: |
| 984 | 984 | $trace = debug_backtrace(DEBUG_BACKTRACE_IGNORE_ARGS); |
| 985 | - trigger_error('Undefined property via __set(): ' . $name . ' in ' . $trace[0]['file'] . ' on line ' . $trace[0]['line'], E_USER_WARNING); |
|
| 985 | + trigger_error('Undefined property via __set(): '.$name.' in '.$trace[0]['file'].' on line '.$trace[0]['line'], E_USER_WARNING); |
|
| 986 | 986 | } |
| 987 | 987 | } |
| 988 | 988 | |
@@ -1006,7 +1006,7 @@ discard block |
||
| 1006 | 1006 | break; |
| 1007 | 1007 | default: |
| 1008 | 1008 | $trace = debug_backtrace(DEBUG_BACKTRACE_IGNORE_ARGS); |
| 1009 | - trigger_error('Undefined property via __unset(): ' . $name . ' in ' . $trace[0]['file'] . ' on line ' . $trace[0]['line'], E_USER_WARNING); |
|
| 1009 | + trigger_error('Undefined property via __unset(): '.$name.' in '.$trace[0]['file'].' on line '.$trace[0]['line'], E_USER_WARNING); |
|
| 1010 | 1010 | } |
| 1011 | 1011 | } |
| 1012 | 1012 | } |