@@ -1,5 +1,5 @@ discard block |
||
1 | 1 | <?php |
2 | -require_once __DIR__ . "/client/_prepend.php"; |
|
2 | +require_once __DIR__."/client/_prepend.php"; |
|
3 | 3 | |
4 | 4 | output('<html lang="en"> |
5 | 5 | <head><title>phpxmlrpc</title></head> |
@@ -10,25 +10,25 @@ discard block |
||
10 | 10 | output("<p>Please note that in most cases you are better off using `new PhpXmlRpc\Encoder()->encode()` to create nested Value objects</p>\n"); |
11 | 11 | |
12 | 12 | $v = new PhpXmlRpc\Value(1234, 'int'); |
13 | -output("Int: <PRE>" . htmlentities($v->serialize()) . "</PRE>"); |
|
13 | +output("Int: <PRE>".htmlentities($v->serialize())."</PRE>"); |
|
14 | 14 | |
15 | 15 | $v = new PhpXmlRpc\Value('Are the following characters escaped? < & >'); |
16 | -output("String <PRE>" . htmlentities($v->serialize()) . "</PRE>"); |
|
16 | +output("String <PRE>".htmlentities($v->serialize())."</PRE>"); |
|
17 | 17 | |
18 | 18 | $v = new PhpXmlRpc\Value(true, 'boolean'); |
19 | -output("Boolean: <PRE>" . htmlentities($v->serialize()) . "</PRE>"); |
|
19 | +output("Boolean: <PRE>".htmlentities($v->serialize())."</PRE>"); |
|
20 | 20 | |
21 | 21 | $v = new PhpXmlRpc\Value(1234.5678, 'double'); |
22 | -output("Double: <PRE>" . htmlentities($v->serialize()) . "</PRE>"); |
|
22 | +output("Double: <PRE>".htmlentities($v->serialize())."</PRE>"); |
|
23 | 23 | |
24 | 24 | $v = new PhpXmlRpc\Value(time(), 'dateTime.iso8601'); |
25 | -output("Datetime (from timestamp): <PRE>" . htmlentities($v->serialize()) . "</PRE>"); |
|
25 | +output("Datetime (from timestamp): <PRE>".htmlentities($v->serialize())."</PRE>"); |
|
26 | 26 | $v = new PhpXmlRpc\Value(new DateTime(), 'dateTime.iso8601'); |
27 | -output("Datetime (from php DateTime): <PRE>" . htmlentities($v->serialize()) . "</PRE>"); |
|
27 | +output("Datetime (from php DateTime): <PRE>".htmlentities($v->serialize())."</PRE>"); |
|
28 | 28 | |
29 | 29 | $v = new PhpXmlRpc\Value('hello world', 'base64'); |
30 | -output("Base64: <PRE>" . htmlentities($v->serialize()) . "</PRE>"); |
|
31 | -output("(value of base64 string is: '" . $v->scalarval() . "')<BR><BR>"); |
|
30 | +output("Base64: <PRE>".htmlentities($v->serialize())."</PRE>"); |
|
31 | +output("(value of base64 string is: '".$v->scalarval()."')<BR><BR>"); |
|
32 | 32 | |
33 | 33 | $v = new PhpXmlRpc\Value( |
34 | 34 | array( |
@@ -41,7 +41,7 @@ discard block |
||
41 | 41 | ), |
42 | 42 | "array" |
43 | 43 | ); |
44 | -output("Array: <PRE>" . htmlentities($v->serialize()) . "</PRE>"); |
|
44 | +output("Array: <PRE>".htmlentities($v->serialize())."</PRE>"); |
|
45 | 45 | |
46 | 46 | $v = new PhpXmlRpc\Value( |
47 | 47 | array( |
@@ -61,10 +61,10 @@ discard block |
||
61 | 61 | ), |
62 | 62 | "struct" |
63 | 63 | ); |
64 | -output("Struct: <PRE>" . htmlentities($v->serialize()) . "</PRE>"); |
|
64 | +output("Struct: <PRE>".htmlentities($v->serialize())."</PRE>"); |
|
65 | 65 | |
66 | 66 | $w = new PhpXmlRpc\Value(array($v), 'array'); |
67 | -output("Array containing a struct: <PRE>" . htmlentities($w->serialize()) . "</PRE>"); |
|
67 | +output("Array containing a struct: <PRE>".htmlentities($w->serialize())."</PRE>"); |
|
68 | 68 | |
69 | 69 | class MyClass |
70 | 70 | { |
@@ -76,49 +76,49 @@ discard block |
||
76 | 76 | // the public property is the only one which will be serialized. As such, it has to be of type Value |
77 | 77 | $myObject->public = new \PhpXmlRpc\Value('a public property, wrapped'); |
78 | 78 | $w = new PhpXmlRpc\Value($myObject, 'struct'); |
79 | -output("Struct encoding a php object: <PRE>" . htmlentities($w->serialize()) . "</PRE>"); |
|
79 | +output("Struct encoding a php object: <PRE>".htmlentities($w->serialize())."</PRE>"); |
|
80 | 80 | |
81 | 81 | output("<h3>Testing value serialization - xml-rpc extensions</h3>\n"); |
82 | 82 | $v = new PhpXmlRpc\Value(1234, 'i8'); |
83 | -output("I8: <PRE>" . htmlentities($v->serialize()) . "</PRE>"); |
|
83 | +output("I8: <PRE>".htmlentities($v->serialize())."</PRE>"); |
|
84 | 84 | $v = new PhpXmlRpc\Value(null, 'null'); |
85 | -output("Null: <PRE>" . htmlentities($v->serialize()) . "</PRE>"); |
|
85 | +output("Null: <PRE>".htmlentities($v->serialize())."</PRE>"); |
|
86 | 86 | \PhpXmlRpc\PhpXmlRpc::$xmlrpc_null_apache_encoding = true; |
87 | -output("Null, alternative: <PRE>" . htmlentities($v->serialize()) . "</PRE>"); |
|
87 | +output("Null, alternative: <PRE>".htmlentities($v->serialize())."</PRE>"); |
|
88 | 88 | |
89 | 89 | output("<h3>Testing value serialization - character encoding</h3>\n"); |
90 | 90 | // The greek word 'kosme' |
91 | 91 | $v = new PhpXmlRpc\Value('κόσμε'); |
92 | -output("Greek (default encoding): <PRE>" . htmlentities($v->serialize()) . "</PRE>"); |
|
93 | -output("Greek (utf8 encoding): <PRE>" . htmlentities($v->serialize('UTF-8')) . "</PRE>"); |
|
92 | +output("Greek (default encoding): <PRE>".htmlentities($v->serialize())."</PRE>"); |
|
93 | +output("Greek (utf8 encoding): <PRE>".htmlentities($v->serialize('UTF-8'))."</PRE>"); |
|
94 | 94 | if (function_exists('mb_convert_encoding')) { |
95 | - output("Greek (ISO-8859-7 encoding): <PRE>" . htmlentities($v->serialize('ISO-8859-7')) . "</PRE>"); |
|
95 | + output("Greek (ISO-8859-7 encoding): <PRE>".htmlentities($v->serialize('ISO-8859-7'))."</PRE>"); |
|
96 | 96 | } |
97 | 97 | |
98 | 98 | output("<h3>Testing request serialization</h3>\n"); |
99 | 99 | $req = new PhpXmlRpc\Request('examples.getStateName'); |
100 | 100 | $req->method('examples.getStateName'); |
101 | 101 | $req->addParam(new PhpXmlRpc\Value(42, 'int')); |
102 | -output("<PRE>" . htmlentities($req->serialize()) . "</PRE>"); |
|
102 | +output("<PRE>".htmlentities($req->serialize())."</PRE>"); |
|
103 | 103 | |
104 | 104 | output("<h3>Testing response serialization</h3>\n"); |
105 | 105 | $resp = new PhpXmlRpc\Response(new PhpXmlRpc\Value('The meaning of life')); |
106 | -output("<PRE>" . htmlentities($resp->serialize()) . "</PRE>"); |
|
106 | +output("<PRE>".htmlentities($resp->serialize())."</PRE>"); |
|
107 | 107 | |
108 | 108 | output("<h3>Testing ISO date formatting</h3><pre>\n"); |
109 | 109 | $t = time(); |
110 | 110 | $date = PhpXmlRpc\Helper\Date::iso8601Encode($t); |
111 | 111 | output("Now is $t --> $date\n"); |
112 | -output("Or in UTC, that is " . PhpXmlRpc\Helper\Date::iso8601Encode($t, 1) . "\n"); |
|
112 | +output("Or in UTC, that is ".PhpXmlRpc\Helper\Date::iso8601Encode($t, 1)."\n"); |
|
113 | 113 | $tb = PhpXmlRpc\Helper\Date::iso8601Decode($date); |
114 | 114 | output("That is to say $date --> $tb\n"); |
115 | -output("Which comes out at " . PhpXmlRpc\Helper\Date::iso8601Encode($tb) . "\n"); |
|
116 | -output("Which was the time in UTC at " . PhpXmlRpc\Helper\Date::iso8601Encode($tb, 1) . "\n"); |
|
115 | +output("Which comes out at ".PhpXmlRpc\Helper\Date::iso8601Encode($tb)."\n"); |
|
116 | +output("Which was the time in UTC at ".PhpXmlRpc\Helper\Date::iso8601Encode($tb, 1)."\n"); |
|
117 | 117 | output("</pre>\n"); |
118 | 118 | |
119 | 119 | output("<h3>Testing reduced-precision formatting for doubles</h3><pre>\n"); |
120 | 120 | $v = new PhpXmlRpc\Value(1234.56789, 'double'); |
121 | 121 | \PhpXmlRpc\PhpXmlRpc::$xmlpc_double_precision = 2; |
122 | -output("Double, limited precision: <PRE>" . htmlentities($v->serialize()) . "</PRE>"); |
|
122 | +output("Double, limited precision: <PRE>".htmlentities($v->serialize())."</PRE>"); |
|
123 | 123 | |
124 | 124 | output('</body></html>'); |
@@ -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() |
@@ -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->truncateForDebug($this->_xh['ac']); |
|
594 | + $this->_xh['isf_reason'] = 'Invalid data received in BOOLEAN value: '.$this->truncateForDebug($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->truncateForDebug($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->truncateForDebug($this->_xh['ac']); |
|
619 | + $this->_xh['isf_reason'] = 'Non numeric data received in INT value: '.$this->truncateForDebug($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->truncateForDebug($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->truncateForDebug($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->truncateForDebug($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->truncateForDebug($this->_xh['ac']); |
|
660 | + $this->_xh['isf_reason'] = 'Invalid data received in DATETIME value: '.$this->truncateForDebug($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->truncateForDebug($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->truncateForDebug($this->_xh['ac']); |
|
687 | + $this->_xh['isf_reason'] = 'Invalid data received in BASE64 value: '.$this->truncateForDebug($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->truncateForDebug($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->truncateForDebug($this->_xh['ac']); |
|
766 | + $this->_xh['isf_reason'] = 'Invalid data received in METHODNAME: '.$this->truncateForDebug($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->truncateForDebug($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,14 +1036,14 @@ 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 | |
1043 | 1043 | protected function truncateForDebug($data) |
1044 | 1044 | { |
1045 | - if (strlen($data) > $this->maxDebugValueLength) { |
|
1046 | - return substr($data, 0, $this->maxDebugValueLength - 3) . '...'; |
|
1045 | + if (strlen($data)>$this->maxDebugValueLength) { |
|
1046 | + return substr($data, 0, $this->maxDebugValueLength-3).'...'; |
|
1047 | 1047 | } |
1048 | 1048 | |
1049 | 1049 | return $data; |