@@ -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 |
@@ -191,12 +191,12 @@ discard block |
||
| 191 | 191 | foreach ($mergedOptions as $key => $val) { |
| 192 | 192 | // q: can php be built without ctype? should we use a regexp? |
| 193 | 193 | if (is_string($key) && !ctype_digit($key)) { |
| 194 | - switch($key) { |
|
| 194 | + switch ($key) { |
|
| 195 | 195 | case 'target_charset': |
| 196 | 196 | if (function_exists('mb_convert_encoding')) { |
| 197 | 197 | $this->current_parsing_options['target_charset'] = $val; |
| 198 | 198 | } else { |
| 199 | - $this->getLogger()->errorLog('XML-RPC: ' . __METHOD__ . ": 'target_charset' option is unsupported without mbstring"); |
|
| 199 | + $this->getLogger()->errorLog('XML-RPC: '.__METHOD__.": 'target_charset' option is unsupported without mbstring"); |
|
| 200 | 200 | } |
| 201 | 201 | break; |
| 202 | 202 | |
@@ -207,7 +207,7 @@ discard block |
||
| 207 | 207 | //$this->_xh['isf'] = 4; |
| 208 | 208 | //$this->_xh['isf_reason'] = "Callback passed as 'methodname_callback' is not callable"; |
| 209 | 209 | //return; |
| 210 | - $this->getLogger()->errorLog('XML-RPC: ' . __METHOD__ . ": Callback passed as 'methodname_callback' is not callable"); |
|
| 210 | + $this->getLogger()->errorLog('XML-RPC: '.__METHOD__.": Callback passed as 'methodname_callback' is not callable"); |
|
| 211 | 211 | } |
| 212 | 212 | break; |
| 213 | 213 | |
@@ -218,7 +218,7 @@ discard block |
||
| 218 | 218 | break; |
| 219 | 219 | |
| 220 | 220 | default: |
| 221 | - $this->getLogger()->errorLog('XML-RPC: ' . __METHOD__ . ": unsupported option: $key"); |
|
| 221 | + $this->getLogger()->errorLog('XML-RPC: '.__METHOD__.": unsupported option: $key"); |
|
| 222 | 222 | } |
| 223 | 223 | unset($mergedOptions[$key]); |
| 224 | 224 | } |
@@ -264,10 +264,10 @@ discard block |
||
| 264 | 264 | |
| 265 | 265 | try { |
| 266 | 266 | // @see ticket #70 - we have to parse big xml docs in chunks to avoid errors |
| 267 | - for ($offset = 0; $offset < $len; $offset += $this->maxChunkLength) { |
|
| 267 | + for ($offset = 0; $offset<$len; $offset += $this->maxChunkLength) { |
|
| 268 | 268 | $chunk = substr($data, $offset, $this->maxChunkLength); |
| 269 | 269 | // error handling: xml not well formed |
| 270 | - if (!xml_parse($parser, $chunk, $offset + $this->maxChunkLength >= $len)) { |
|
| 270 | + if (!xml_parse($parser, $chunk, $offset+$this->maxChunkLength>=$len)) { |
|
| 271 | 271 | $errCode = xml_get_error_code($parser); |
| 272 | 272 | $errStr = sprintf('XML error %s: %s at line %d, column %d', $errCode, xml_error_string($errCode), |
| 273 | 273 | xml_get_current_line_number($parser), xml_get_current_column_number($parser)); |
@@ -277,7 +277,7 @@ discard block |
||
| 277 | 277 | break; |
| 278 | 278 | } |
| 279 | 279 | // no need to parse further if we already have a fatal error |
| 280 | - if ($this->_xh['isf'] >= 2) { |
|
| 280 | + if ($this->_xh['isf']>=2) { |
|
| 281 | 281 | break; |
| 282 | 282 | } |
| 283 | 283 | } |
@@ -309,7 +309,7 @@ discard block |
||
| 309 | 309 | public function xmlrpc_se($parser, $name, $attrs, $acceptSingleVals = false) |
| 310 | 310 | { |
| 311 | 311 | // if invalid xml-rpc already detected, skip all processing |
| 312 | - if ($this->_xh['isf'] >= 2) { |
|
| 312 | + if ($this->_xh['isf']>=2) { |
|
| 313 | 313 | return; |
| 314 | 314 | } |
| 315 | 315 | |
@@ -332,7 +332,7 @@ discard block |
||
| 332 | 332 | $this->_xh['rt'] = strtolower($name); |
| 333 | 333 | } else { |
| 334 | 334 | $this->_xh['isf'] = 2; |
| 335 | - $this->_xh['isf_reason'] = 'missing top level xmlrpc element. Found: ' . $name; |
|
| 335 | + $this->_xh['isf_reason'] = 'missing top level xmlrpc element. Found: '.$name; |
|
| 336 | 336 | |
| 337 | 337 | return; |
| 338 | 338 | } |
@@ -434,7 +434,7 @@ discard block |
||
| 434 | 434 | |
| 435 | 435 | case 'MEMBER': |
| 436 | 436 | // set member name to null, in case we do not find in the xml later on |
| 437 | - $this->_xh['valuestack'][count($this->_xh['valuestack']) - 1]['name'] = null; |
|
| 437 | + $this->_xh['valuestack'][count($this->_xh['valuestack'])-1]['name'] = null; |
|
| 438 | 438 | //$this->_xh['ac']=''; |
| 439 | 439 | // Drop trough intentionally |
| 440 | 440 | |
@@ -508,7 +508,7 @@ discard block |
||
| 508 | 508 | */ |
| 509 | 509 | public function xmlrpc_ee($parser, $name, $rebuildXmlrpcvals = 1) |
| 510 | 510 | { |
| 511 | - if ($this->_xh['isf'] >= 2) { |
|
| 511 | + if ($this->_xh['isf']>=2) { |
|
| 512 | 512 | return; |
| 513 | 513 | |
| 514 | 514 | } |
@@ -530,7 +530,7 @@ discard block |
||
| 530 | 530 | $this->_xh['value'] = mb_convert_encoding($this->_xh['value'], $this->current_parsing_options['target_charset'], 'UTF-8'); |
| 531 | 531 | } |
| 532 | 532 | |
| 533 | - if ($rebuildXmlrpcvals > 0) { |
|
| 533 | + if ($rebuildXmlrpcvals>0) { |
|
| 534 | 534 | // build the xml-rpc val out of the data received, and substitute it |
| 535 | 535 | $temp = new Value($this->_xh['value'], $this->_xh['vt']); |
| 536 | 536 | // in case we got info about underlying php class, save it in the object we're rebuilding |
@@ -538,15 +538,15 @@ discard block |
||
| 538 | 538 | $temp->_php_class = $this->_xh['php_class']; |
| 539 | 539 | } |
| 540 | 540 | $this->_xh['value'] = $temp; |
| 541 | - } elseif ($rebuildXmlrpcvals < 0) { |
|
| 541 | + } elseif ($rebuildXmlrpcvals<0) { |
|
| 542 | 542 | if ($this->_xh['vt'] == Value::$xmlrpcDateTime) { |
| 543 | - $this->_xh['value'] = (object)array( |
|
| 543 | + $this->_xh['value'] = (object) array( |
|
| 544 | 544 | 'xmlrpc_type' => 'datetime', |
| 545 | 545 | 'scalar' => $this->_xh['value'], |
| 546 | 546 | 'timestamp' => \PhpXmlRpc\Helper\Date::iso8601Decode($this->_xh['value']) |
| 547 | 547 | ); |
| 548 | 548 | } elseif ($this->_xh['vt'] == Value::$xmlrpcBase64) { |
| 549 | - $this->_xh['value'] = (object)array( |
|
| 549 | + $this->_xh['value'] = (object) array( |
|
| 550 | 550 | 'xmlrpc_type' => 'base64', |
| 551 | 551 | 'scalar' => $this->_xh['value'] |
| 552 | 552 | ); |
@@ -561,8 +561,8 @@ discard block |
||
| 561 | 561 | // check if we are inside an array or struct: |
| 562 | 562 | // if value just built is inside an array, let's move it into array on the stack |
| 563 | 563 | $vscount = count($this->_xh['valuestack']); |
| 564 | - if ($vscount && $this->_xh['valuestack'][$vscount - 1]['type'] == 'ARRAY') { |
|
| 565 | - $this->_xh['valuestack'][$vscount - 1]['values'][] = $this->_xh['value']; |
|
| 564 | + if ($vscount && $this->_xh['valuestack'][$vscount-1]['type'] == 'ARRAY') { |
|
| 565 | + $this->_xh['valuestack'][$vscount-1]['values'][] = $this->_xh['value']; |
|
| 566 | 566 | } |
| 567 | 567 | break; |
| 568 | 568 | |
@@ -591,10 +591,10 @@ discard block |
||
| 591 | 591 | if ($this->_xh['ac'] != '0' && strcasecmp($this->_xh['ac'], 'false') !== 0) { |
| 592 | 592 | if ($this->current_parsing_options['xmlrpc_reject_invalid_values']) { |
| 593 | 593 | $this->_xh['isf'] = 2; |
| 594 | - $this->_xh['isf_reason'] = 'Invalid data received in BOOLEAN value: ' . $this->truncateForLog($this->_xh['ac']); |
|
| 594 | + $this->_xh['isf_reason'] = 'Invalid data received in BOOLEAN value: '.$this->truncateForLog($this->_xh['ac']); |
|
| 595 | 595 | return; |
| 596 | 596 | } else { |
| 597 | - $this->getLogger()->errorLog('XML-RPC: ' . __METHOD__ . ': invalid data received in BOOLEAN value: ' . |
|
| 597 | + $this->getLogger()->errorLog('XML-RPC: '.__METHOD__.': invalid data received in BOOLEAN value: '. |
|
| 598 | 598 | $this->truncateForLog($this->_xh['ac'])); |
| 599 | 599 | } |
| 600 | 600 | } |
@@ -616,17 +616,17 @@ discard block |
||
| 616 | 616 | if ($this->current_parsing_options['xmlrpc_reject_invalid_values']) |
| 617 | 617 | { |
| 618 | 618 | $this->_xh['isf'] = 2; |
| 619 | - $this->_xh['isf_reason'] = 'Non numeric data received in INT value: ' . $this->truncateForLog($this->_xh['ac']); |
|
| 619 | + $this->_xh['isf_reason'] = 'Non numeric data received in INT value: '.$this->truncateForLog($this->_xh['ac']); |
|
| 620 | 620 | return; |
| 621 | 621 | } else { |
| 622 | - $this->getLogger()->errorLog('XML-RPC: ' . __METHOD__ . ': non numeric data received in INT: ' . |
|
| 622 | + $this->getLogger()->errorLog('XML-RPC: '.__METHOD__.': non numeric data received in INT: '. |
|
| 623 | 623 | $this->truncateForLog($this->_xh['ac'])); |
| 624 | 624 | } |
| 625 | 625 | /// @todo: find a better way of reporting an error value than this! Use NaN? |
| 626 | 626 | $this->_xh['value'] = 'ERROR_NON_NUMERIC_FOUND'; |
| 627 | 627 | } else { |
| 628 | 628 | // it's ok, add it on |
| 629 | - $this->_xh['value'] = (int)$this->_xh['ac']; |
|
| 629 | + $this->_xh['value'] = (int) $this->_xh['ac']; |
|
| 630 | 630 | } |
| 631 | 631 | break; |
| 632 | 632 | |
@@ -636,18 +636,18 @@ discard block |
||
| 636 | 636 | if (!preg_match(PhpXmlRpc::$xmlrpc_double_format, $this->_xh['ac'])) { |
| 637 | 637 | if ($this->current_parsing_options['xmlrpc_reject_invalid_values']) { |
| 638 | 638 | $this->_xh['isf'] = 2; |
| 639 | - $this->_xh['isf_reason'] = 'Non numeric data received in DOUBLE value: ' . |
|
| 639 | + $this->_xh['isf_reason'] = 'Non numeric data received in DOUBLE value: '. |
|
| 640 | 640 | $this->truncateForLog($this->_xh['ac']); |
| 641 | 641 | return; |
| 642 | 642 | } else { |
| 643 | - $this->getLogger()->errorLog('XML-RPC: ' . __METHOD__ . ': non numeric data received in DOUBLE value: ' . |
|
| 643 | + $this->getLogger()->errorLog('XML-RPC: '.__METHOD__.': non numeric data received in DOUBLE value: '. |
|
| 644 | 644 | $this->truncateForLog($this->_xh['ac'])); |
| 645 | 645 | } |
| 646 | 646 | |
| 647 | 647 | $this->_xh['value'] = 'ERROR_NON_NUMERIC_FOUND'; |
| 648 | 648 | } else { |
| 649 | 649 | // it's ok, add it on |
| 650 | - $this->_xh['value'] = (double)$this->_xh['ac']; |
|
| 650 | + $this->_xh['value'] = (double) $this->_xh['ac']; |
|
| 651 | 651 | } |
| 652 | 652 | break; |
| 653 | 653 | |
@@ -657,19 +657,19 @@ discard block |
||
| 657 | 657 | if (!preg_match(PhpXmlRpc::$xmlrpc_datetime_format, $this->_xh['ac'])) { |
| 658 | 658 | if ($this->current_parsing_options['xmlrpc_reject_invalid_values']) { |
| 659 | 659 | $this->_xh['isf'] = 2; |
| 660 | - $this->_xh['isf_reason'] = 'Invalid data received in DATETIME value: ' . $this->truncateForLog($this->_xh['ac']); |
|
| 660 | + $this->_xh['isf_reason'] = 'Invalid data received in DATETIME value: '.$this->truncateForLog($this->_xh['ac']); |
|
| 661 | 661 | return; |
| 662 | 662 | } else { |
| 663 | - $this->getLogger()->errorLog('XML-RPC: ' . __METHOD__ . ': invalid data received in DATETIME value: ' . |
|
| 663 | + $this->getLogger()->errorLog('XML-RPC: '.__METHOD__.': invalid data received in DATETIME value: '. |
|
| 664 | 664 | $this->truncateForLog($this->_xh['ac'])); |
| 665 | 665 | } |
| 666 | 666 | } |
| 667 | 667 | if ($this->current_parsing_options['xmlrpc_return_datetimes']) { |
| 668 | 668 | try { |
| 669 | 669 | $this->_xh['value'] = new \DateTime($this->_xh['ac']); |
| 670 | - } catch(\Exception $e) { |
|
| 670 | + } catch (\Exception $e) { |
|
| 671 | 671 | // q: what to do? we can not guarantee that a valid date can be created. Return null or throw? |
| 672 | - $this->getLogger()->errorLog('XML-RPC: ' . __METHOD__ . ': ' . $e->getMessage()); |
|
| 672 | + $this->getLogger()->errorLog('XML-RPC: '.__METHOD__.': '.$e->getMessage()); |
|
| 673 | 673 | $this->_xh['value'] = null; |
| 674 | 674 | } |
| 675 | 675 | } else { |
@@ -684,14 +684,14 @@ discard block |
||
| 684 | 684 | $v = base64_decode($this->_xh['ac'], true); |
| 685 | 685 | if ($v === false) { |
| 686 | 686 | $this->_xh['isf'] = 2; |
| 687 | - $this->_xh['isf_reason'] = 'Invalid data received in BASE64 value: '. $this->truncateForLog($this->_xh['ac']); |
|
| 687 | + $this->_xh['isf_reason'] = 'Invalid data received in BASE64 value: '.$this->truncateForLog($this->_xh['ac']); |
|
| 688 | 688 | return; |
| 689 | 689 | } |
| 690 | 690 | } else { |
| 691 | 691 | $v = base64_decode($this->_xh['ac']); |
| 692 | 692 | if ($v === '' && $this->_xh['ac'] !== '') { |
| 693 | 693 | // only the empty string should decode to the empty string |
| 694 | - $this->getLogger()->errorLog('XML-RPC: ' . __METHOD__ . ': invalid data received in BASE64 value: ' . |
|
| 694 | + $this->getLogger()->errorLog('XML-RPC: '.__METHOD__.': invalid data received in BASE64 value: '. |
|
| 695 | 695 | $this->truncateForLog($this->_xh['ac'])); |
| 696 | 696 | } |
| 697 | 697 | } |
@@ -699,31 +699,31 @@ discard block |
||
| 699 | 699 | break; |
| 700 | 700 | |
| 701 | 701 | case 'NAME': |
| 702 | - $this->_xh['valuestack'][count($this->_xh['valuestack']) - 1]['name'] = $this->_xh['ac']; |
|
| 702 | + $this->_xh['valuestack'][count($this->_xh['valuestack'])-1]['name'] = $this->_xh['ac']; |
|
| 703 | 703 | break; |
| 704 | 704 | |
| 705 | 705 | case 'MEMBER': |
| 706 | 706 | // add to array in the stack the last element built, unless no VALUE or no NAME were found |
| 707 | 707 | if ($this->_xh['vt']) { |
| 708 | 708 | $vscount = count($this->_xh['valuestack']); |
| 709 | - if ($this->_xh['valuestack'][$vscount - 1]['name'] === null) { |
|
| 709 | + if ($this->_xh['valuestack'][$vscount-1]['name'] === null) { |
|
| 710 | 710 | if ($this->current_parsing_options['xmlrpc_reject_invalid_values']) { |
| 711 | 711 | $this->_xh['isf'] = 2; |
| 712 | 712 | $this->_xh['isf_reason'] = 'Missing NAME inside STRUCT in received xml'; |
| 713 | 713 | return; |
| 714 | 714 | } else { |
| 715 | - $this->getLogger()->errorLog('XML-RPC: ' . __METHOD__ . ': missing NAME inside STRUCT in received xml'); |
|
| 715 | + $this->getLogger()->errorLog('XML-RPC: '.__METHOD__.': missing NAME inside STRUCT in received xml'); |
|
| 716 | 716 | } |
| 717 | - $this->_xh['valuestack'][$vscount - 1]['name'] = ''; |
|
| 717 | + $this->_xh['valuestack'][$vscount-1]['name'] = ''; |
|
| 718 | 718 | } |
| 719 | - $this->_xh['valuestack'][$vscount - 1]['values'][$this->_xh['valuestack'][$vscount - 1]['name']] = $this->_xh['value']; |
|
| 719 | + $this->_xh['valuestack'][$vscount-1]['values'][$this->_xh['valuestack'][$vscount-1]['name']] = $this->_xh['value']; |
|
| 720 | 720 | } else { |
| 721 | 721 | if ($this->current_parsing_options['xmlrpc_reject_invalid_values']) { |
| 722 | 722 | $this->_xh['isf'] = 2; |
| 723 | 723 | $this->_xh['isf_reason'] = 'Missing VALUE inside STRUCT in received xml'; |
| 724 | 724 | return; |
| 725 | 725 | } else { |
| 726 | - $this->getLogger()->errorLog('XML-RPC: ' . __METHOD__ . ': missing VALUE inside STRUCT in received xml'); |
|
| 726 | + $this->getLogger()->errorLog('XML-RPC: '.__METHOD__.': missing VALUE inside STRUCT in received xml'); |
|
| 727 | 727 | } |
| 728 | 728 | } |
| 729 | 729 | break; |
@@ -754,7 +754,7 @@ discard block |
||
| 754 | 754 | $this->_xh['isf_reason'] = 'Missing VALUE inside PARAM in received xml'; |
| 755 | 755 | return; |
| 756 | 756 | } else { |
| 757 | - $this->getLogger()->errorLog('XML-RPC: ' . __METHOD__ . ': missing VALUE inside PARAM in received xml'); |
|
| 757 | + $this->getLogger()->errorLog('XML-RPC: '.__METHOD__.': missing VALUE inside PARAM in received xml'); |
|
| 758 | 758 | } |
| 759 | 759 | } |
| 760 | 760 | break; |
@@ -763,10 +763,10 @@ discard block |
||
| 763 | 763 | if (!preg_match(PhpXmlRpc::$xmlrpc_methodname_format, $this->_xh['ac'])) { |
| 764 | 764 | if ($this->current_parsing_options['xmlrpc_reject_invalid_values']) { |
| 765 | 765 | $this->_xh['isf'] = 2; |
| 766 | - $this->_xh['isf_reason'] = 'Invalid data received in METHODNAME: '. $this->truncateForLog($this->_xh['ac']); |
|
| 766 | + $this->_xh['isf_reason'] = 'Invalid data received in METHODNAME: '.$this->truncateForLog($this->_xh['ac']); |
|
| 767 | 767 | return; |
| 768 | 768 | } else { |
| 769 | - $this->getLogger()->errorLog('XML-RPC: ' . __METHOD__ . ': invalid data received in METHODNAME: '. |
|
| 769 | + $this->getLogger()->errorLog('XML-RPC: '.__METHOD__.': invalid data received in METHODNAME: '. |
|
| 770 | 770 | $this->truncateForLog($this->_xh['ac'])); |
| 771 | 771 | } |
| 772 | 772 | } |
@@ -839,7 +839,7 @@ discard block |
||
| 839 | 839 | public function xmlrpc_cd($parser, $data) |
| 840 | 840 | { |
| 841 | 841 | // skip processing if xml fault already detected |
| 842 | - if ($this->_xh['isf'] >= 2) { |
|
| 842 | + if ($this->_xh['isf']>=2) { |
|
| 843 | 843 | return; |
| 844 | 844 | } |
| 845 | 845 | |
@@ -861,7 +861,7 @@ discard block |
||
| 861 | 861 | public function xmlrpc_dh($parser, $data) |
| 862 | 862 | { |
| 863 | 863 | // skip processing if xml fault already detected |
| 864 | - if ($this->_xh['isf'] >= 2) { |
|
| 864 | + if ($this->_xh['isf']>=2) { |
|
| 865 | 865 | return; |
| 866 | 866 | } |
| 867 | 867 | |
@@ -935,8 +935,8 @@ discard block |
||
| 935 | 935 | // Details: |
| 936 | 936 | // SPACE: (#x20 | #x9 | #xD | #xA)+ === [ \x9\xD\xA]+ |
| 937 | 937 | // EQ: SPACE?=SPACE? === [ \x9\xD\xA]*=[ \x9\xD\xA]* |
| 938 | - if (preg_match('/^<\?xml\s+version\s*=\s*' . "((?:\"[a-zA-Z0-9_.:-]+\")|(?:'[a-zA-Z0-9_.:-]+'))" . |
|
| 939 | - '\s+encoding\s*=\s*' . "((?:\"[A-Za-z][A-Za-z0-9._-]*\")|(?:'[A-Za-z][A-Za-z0-9._-]*'))/", |
|
| 938 | + if (preg_match('/^<\?xml\s+version\s*=\s*'."((?:\"[a-zA-Z0-9_.:-]+\")|(?:'[a-zA-Z0-9_.:-]+'))". |
|
| 939 | + '\s+encoding\s*=\s*'."((?:\"[A-Za-z][A-Za-z0-9._-]*\")|(?:'[A-Za-z][A-Za-z0-9._-]*'))/", |
|
| 940 | 940 | $xmlChunk, $matches)) { |
| 941 | 941 | return strtoupper(substr($matches[2], 1, -1)); |
| 942 | 942 | } |
@@ -954,7 +954,7 @@ discard block |
||
| 954 | 954 | // NB: mb_detect likes to call it ascii, xml parser likes to call it US_ASCII... |
| 955 | 955 | // IANA also likes better US-ASCII, so go with it |
| 956 | 956 | if ($enc == 'ASCII') { |
| 957 | - $enc = 'US-' . $enc; |
|
| 957 | + $enc = 'US-'.$enc; |
|
| 958 | 958 | } |
| 959 | 959 | |
| 960 | 960 | return $enc; |
@@ -991,8 +991,8 @@ discard block |
||
| 991 | 991 | // Details: |
| 992 | 992 | // SPACE: (#x20 | #x9 | #xD | #xA)+ === [ \x9\xD\xA]+ |
| 993 | 993 | // EQ: SPACE?=SPACE? === [ \x9\xD\xA]*=[ \x9\xD\xA]* |
| 994 | - if (preg_match('/^<\?xml\s+version\s*=\s*' . "((?:\"[a-zA-Z0-9_.:-]+\")|(?:'[a-zA-Z0-9_.:-]+'))" . |
|
| 995 | - '\s+encoding\s*=\s*' . "((?:\"[A-Za-z][A-Za-z0-9._-]*\")|(?:'[A-Za-z][A-Za-z0-9._-]*'))/", |
|
| 994 | + if (preg_match('/^<\?xml\s+version\s*=\s*'."((?:\"[a-zA-Z0-9_.:-]+\")|(?:'[a-zA-Z0-9_.:-]+'))". |
|
| 995 | + '\s+encoding\s*=\s*'."((?:\"[A-Za-z][A-Za-z0-9._-]*\")|(?:'[A-Za-z][A-Za-z0-9._-]*'))/", |
|
| 996 | 996 | $xmlChunk)) { |
| 997 | 997 | return true; |
| 998 | 998 | } |
@@ -1012,7 +1012,7 @@ discard block |
||
| 1012 | 1012 | break; |
| 1013 | 1013 | default: |
| 1014 | 1014 | $trace = debug_backtrace(DEBUG_BACKTRACE_IGNORE_ARGS); |
| 1015 | - trigger_error('Undefined property via __set(): ' . $name . ' in ' . $trace[0]['file'] . ' on line ' . $trace[0]['line'], E_USER_WARNING); |
|
| 1015 | + trigger_error('Undefined property via __set(): '.$name.' in '.$trace[0]['file'].' on line '.$trace[0]['line'], E_USER_WARNING); |
|
| 1016 | 1016 | } |
| 1017 | 1017 | } |
| 1018 | 1018 | |
@@ -1036,7 +1036,7 @@ discard block |
||
| 1036 | 1036 | break; |
| 1037 | 1037 | default: |
| 1038 | 1038 | $trace = debug_backtrace(DEBUG_BACKTRACE_IGNORE_ARGS); |
| 1039 | - trigger_error('Undefined property via __unset(): ' . $name . ' in ' . $trace[0]['file'] . ' on line ' . $trace[0]['line'], E_USER_WARNING); |
|
| 1039 | + trigger_error('Undefined property via __unset(): '.$name.' in '.$trace[0]['file'].' on line '.$trace[0]['line'], E_USER_WARNING); |
|
| 1040 | 1040 | } |
| 1041 | 1041 | } |
| 1042 | 1042 | |
@@ -1047,8 +1047,8 @@ discard block |
||
| 1047 | 1047 | */ |
| 1048 | 1048 | protected function truncateForLog($data) |
| 1049 | 1049 | { |
| 1050 | - if (strlen($data) > $this->maxLogValueLength) { |
|
| 1051 | - return substr($data, 0, $this->maxLogValueLength - 3) . '...'; |
|
| 1050 | + if (strlen($data)>$this->maxLogValueLength) { |
|
| 1051 | + return substr($data, 0, $this->maxLogValueLength-3).'...'; |
|
| 1052 | 1052 | } |
| 1053 | 1053 | |
| 1054 | 1054 | return $data; |
@@ -24,7 +24,7 @@ discard block |
||
| 24 | 24 | } |
| 25 | 25 | } |
| 26 | 26 | |
| 27 | -require_once __DIR__ . "/_prepend.php"; |
|
| 27 | +require_once __DIR__."/_prepend.php"; |
|
| 28 | 28 | |
| 29 | 29 | use PhpXmlRpc\PhpXmlRpc; |
| 30 | 30 | use PhpXmlRpc\Server; |
@@ -83,7 +83,7 @@ discard block |
||
| 83 | 83 | } elseif ($_GET['FORCE_AUTH'] == 'Digest') { |
| 84 | 84 | if (empty($_SERVER['PHP_AUTH_DIGEST'])) { |
| 85 | 85 | header('HTTP/1.1 401 Unauthorized'); |
| 86 | - header('WWW-Authenticate: Digest realm="Phpxmlrpc Digest Realm",qop="auth",nonce="' . uniqid() . '",opaque="' . md5('Phpxmlrpc Digest Realm') . '"'); |
|
| 86 | + header('WWW-Authenticate: Digest realm="Phpxmlrpc Digest Realm",qop="auth",nonce="'.uniqid().'",opaque="'.md5('Phpxmlrpc Digest Realm').'"'); |
|
| 87 | 87 | die('Text visible if user hits Cancel button'); |
| 88 | 88 | } |
| 89 | 89 | } |
@@ -91,7 +91,7 @@ discard block |
||
| 91 | 91 | if (isset($_GET['FORCE_REDIRECT'])) { |
| 92 | 92 | header('HTTP/1.0 302 Found'); |
| 93 | 93 | unset($_GET['FORCE_REDIRECT']); |
| 94 | - header('Location: ' . $_SERVER['REQUEST_URI'] . (count($_GET) ? '?' . http_build_query($_GET) : '')); |
|
| 94 | + header('Location: '.$_SERVER['REQUEST_URI'].(count($_GET) ? '?'.http_build_query($_GET) : '')); |
|
| 95 | 95 | die(); |
| 96 | 96 | } |
| 97 | 97 | } |
@@ -109,9 +109,9 @@ discard block |
||
| 109 | 109 | public function xml_header($charsetEncoding = '') |
| 110 | 110 | { |
| 111 | 111 | if ($charsetEncoding != '') { |
| 112 | - return "<?xml version=\"1.0\" encoding=\"$charsetEncoding\" ?" . ">\n<methodCall>\n"; |
|
| 112 | + return "<?xml version=\"1.0\" encoding=\"$charsetEncoding\" ?".">\n<methodCall>\n"; |
|
| 113 | 113 | } else { |
| 114 | - return "<?xml version=\"1.0\"?" . ">\n<methodCall>\n"; |
|
| 114 | + return "<?xml version=\"1.0\"?".">\n<methodCall>\n"; |
|
| 115 | 115 | } |
| 116 | 116 | } |
| 117 | 117 | |
@@ -134,16 +134,16 @@ discard block |
||
| 134 | 134 | public function createPayload($charsetEncoding = '') |
| 135 | 135 | { |
| 136 | 136 | if ($charsetEncoding != '') { |
| 137 | - $this->content_type = 'text/xml; charset=' . $charsetEncoding; |
|
| 137 | + $this->content_type = 'text/xml; charset='.$charsetEncoding; |
|
| 138 | 138 | } else { |
| 139 | 139 | $this->content_type = 'text/xml'; |
| 140 | 140 | } |
| 141 | 141 | $this->payload = $this->xml_header($charsetEncoding); |
| 142 | - $this->payload .= '<methodName>' . $this->getCharsetEncoder()->encodeEntities( |
|
| 143 | - $this->methodname, PhpXmlRpc::$xmlrpc_internalencoding, $charsetEncoding) . "</methodName>\n"; |
|
| 142 | + $this->payload .= '<methodName>'.$this->getCharsetEncoder()->encodeEntities( |
|
| 143 | + $this->methodname, PhpXmlRpc::$xmlrpc_internalencoding, $charsetEncoding)."</methodName>\n"; |
|
| 144 | 144 | $this->payload .= "<params>\n"; |
| 145 | 145 | foreach ($this->params as $p) { |
| 146 | - $this->payload .= "<param>\n" . $p->serialize($charsetEncoding) . |
|
| 146 | + $this->payload .= "<param>\n".$p->serialize($charsetEncoding). |
|
| 147 | 147 | "</param>\n"; |
| 148 | 148 | } |
| 149 | 149 | $this->payload .= "</params>\n"; |
@@ -258,7 +258,7 @@ discard block |
||
| 258 | 258 | */ |
| 259 | 259 | public function parseResponse($data = '', $headersProcessed = false, $returnType = XMLParser::RETURN_XMLRPCVALS) |
| 260 | 260 | { |
| 261 | - if ($this->debug > 0) { |
|
| 261 | + if ($this->debug>0) { |
|
| 262 | 262 | $this->getLogger()->debugMessage("---GOT---\n$data\n---END---"); |
| 263 | 263 | } |
| 264 | 264 | |
@@ -266,7 +266,7 @@ discard block |
||
| 266 | 266 | $this->httpResponse = $httpResponse; |
| 267 | 267 | |
| 268 | 268 | if ($data == '') { |
| 269 | - $this->getLogger()->errorLog('XML-RPC: ' . __METHOD__ . ': no response received from server.'); |
|
| 269 | + $this->getLogger()->errorLog('XML-RPC: '.__METHOD__.': no response received from server.'); |
|
| 270 | 270 | return new Response(0, PhpXmlRpc::$xmlrpcerr['no_data'], PhpXmlRpc::$xmlrpcstr['no_data']); |
| 271 | 271 | } |
| 272 | 272 | |
@@ -274,12 +274,12 @@ discard block |
||
| 274 | 274 | if (substr($data, 0, 4) == 'HTTP') { |
| 275 | 275 | $httpParser = new Http(); |
| 276 | 276 | try { |
| 277 | - $httpResponse = $httpParser->parseResponseHeaders($data, $headersProcessed, $this->debug > 0); |
|
| 277 | + $httpResponse = $httpParser->parseResponseHeaders($data, $headersProcessed, $this->debug>0); |
|
| 278 | 278 | } catch (HttpException $e) { |
| 279 | 279 | // failed processing of HTTP response headers |
| 280 | 280 | // save into response obj the full payload received, for debugging |
| 281 | 281 | return new Response(0, $e->getCode(), $e->getMessage(), '', array('raw_data' => $data, 'status_code', $e->statusCode())); |
| 282 | - } catch(\Exception $e) { |
|
| 282 | + } catch (\Exception $e) { |
|
| 283 | 283 | return new Response(0, $e->getCode(), $e->getMessage(), '', array('raw_data' => $data)); |
| 284 | 284 | } |
| 285 | 285 | } |
@@ -293,7 +293,7 @@ discard block |
||
| 293 | 293 | // idea from Luca Mariano <[email protected]> originally in PEARified version of the lib |
| 294 | 294 | $pos = strrpos($data, '</methodResponse>'); |
| 295 | 295 | if ($pos !== false) { |
| 296 | - $data = substr($data, 0, $pos + 17); |
|
| 296 | + $data = substr($data, 0, $pos+17); |
|
| 297 | 297 | } |
| 298 | 298 | |
| 299 | 299 | // try to 'guestimate' the character encoding of the received response |
@@ -302,20 +302,20 @@ discard block |
||
| 302 | 302 | $data |
| 303 | 303 | ); |
| 304 | 304 | |
| 305 | - if ($this->debug >= 0) { |
|
| 305 | + if ($this->debug>=0) { |
|
| 306 | 306 | $this->httpResponse = $httpResponse; |
| 307 | 307 | } else { |
| 308 | 308 | $httpResponse = null; |
| 309 | 309 | } |
| 310 | 310 | |
| 311 | - if ($this->debug > 0) { |
|
| 311 | + if ($this->debug>0) { |
|
| 312 | 312 | $start = strpos($data, '<!-- SERVER DEBUG INFO (BASE64 ENCODED):'); |
| 313 | 313 | if ($start) { |
| 314 | 314 | $start += strlen('<!-- SERVER DEBUG INFO (BASE64 ENCODED):'); |
| 315 | 315 | $end = strpos($data, '-->', $start); |
| 316 | - $comments = substr($data, $start, $end - $start); |
|
| 317 | - $this->getLogger()->debugMessage("---SERVER DEBUG INFO (DECODED) ---\n\t" . |
|
| 318 | - str_replace("\n", "\n\t", base64_decode($comments)) . "\n---END---", $respEncoding); |
|
| 316 | + $comments = substr($data, $start, $end-$start); |
|
| 317 | + $this->getLogger()->debugMessage("---SERVER DEBUG INFO (DECODED) ---\n\t". |
|
| 318 | + str_replace("\n", "\n\t", base64_decode($comments))."\n---END---", $respEncoding); |
|
| 319 | 319 | } |
| 320 | 320 | } |
| 321 | 321 | |
@@ -337,7 +337,7 @@ discard block |
||
| 337 | 337 | if ($respEncoding == 'ISO-8859-1') { |
| 338 | 338 | $data = utf8_encode($data); |
| 339 | 339 | } else { |
| 340 | - $this->getLogger()->errorLog('XML-RPC: ' . __METHOD__ . ': unsupported charset encoding of received response: ' . $respEncoding); |
|
| 340 | + $this->getLogger()->errorLog('XML-RPC: '.__METHOD__.': unsupported charset encoding of received response: '.$respEncoding); |
|
| 341 | 341 | } |
| 342 | 342 | } |
| 343 | 343 | } |
@@ -363,18 +363,18 @@ discard block |
||
| 363 | 363 | // there could be proxies meddling with the request, or network data corruption... |
| 364 | 364 | |
| 365 | 365 | $r = new Response(0, PhpXmlRpc::$xmlrpcerr['invalid_xml'], |
| 366 | - PhpXmlRpc::$xmlrpcstr['invalid_xml'] . ' ' . $xmlRpcParser->_xh['isf_reason'], '', |
|
| 366 | + PhpXmlRpc::$xmlrpcstr['invalid_xml'].' '.$xmlRpcParser->_xh['isf_reason'], '', |
|
| 367 | 367 | $httpResponse |
| 368 | 368 | ); |
| 369 | 369 | |
| 370 | - if ($this->debug > 0) { |
|
| 370 | + if ($this->debug>0) { |
|
| 371 | 371 | $this->getLogger()->debugMessage($xmlRpcParser->_xh['isf_reason']); |
| 372 | 372 | } |
| 373 | 373 | } |
| 374 | 374 | // second error check: xml well-formed but not xml-rpc compliant |
| 375 | 375 | elseif ($xmlRpcParser->_xh['isf'] == 2) { |
| 376 | 376 | $r = new Response(0, PhpXmlRpc::$xmlrpcerr['xml_not_compliant'], |
| 377 | - PhpXmlRpc::$xmlrpcstr['xml_not_compliant'] . ' ' . $xmlRpcParser->_xh['isf_reason'], '', |
|
| 377 | + PhpXmlRpc::$xmlrpcstr['xml_not_compliant'].' '.$xmlRpcParser->_xh['isf_reason'], '', |
|
| 378 | 378 | $httpResponse |
| 379 | 379 | ); |
| 380 | 380 | |
@@ -385,7 +385,7 @@ discard block |
||
| 385 | 385 | } |
| 386 | 386 | // third error check: parsing of the response has somehow gone boink. |
| 387 | 387 | /// @todo shall we omit this check, since we trust the parsing code? |
| 388 | - elseif ($xmlRpcParser->_xh['isf'] > 3 || $returnType == XMLParser::RETURN_XMLRPCVALS && !is_object($xmlRpcParser->_xh['value'])) { |
|
| 388 | + elseif ($xmlRpcParser->_xh['isf']>3 || $returnType == XMLParser::RETURN_XMLRPCVALS && !is_object($xmlRpcParser->_xh['value'])) { |
|
| 389 | 389 | // something odd has happened and it's time to generate a client side error indicating something odd went on |
| 390 | 390 | $r = new Response(0, PhpXmlRpc::$xmlrpcerr['xml_parsing_error'], PhpXmlRpc::$xmlrpcstr['xml_parsing_error'], |
| 391 | 391 | '', $httpResponse |
@@ -393,7 +393,7 @@ discard block |
||
| 393 | 393 | |
| 394 | 394 | /// @todo echo something for the user? |
| 395 | 395 | } else { |
| 396 | - if ($this->debug > 1) { |
|
| 396 | + if ($this->debug>1) { |
|
| 397 | 397 | $this->getLogger()->debugMessage( |
| 398 | 398 | "---PARSED---\n".var_export($xmlRpcParser->_xh['value'], true)."\n---END---" |
| 399 | 399 | ); |