@@ -26,12 +26,12 @@ discard block |
||
| 26 | 26 | |
| 27 | 27 | // read chunk-size, chunk-extension (if any) and crlf |
| 28 | 28 | // get the position of the linebreak |
| 29 | - $chunkEnd = strpos($buffer, "\r\n") + 2; |
|
| 29 | + $chunkEnd = strpos($buffer, "\r\n")+2; |
|
| 30 | 30 | $temp = substr($buffer, 0, $chunkEnd); |
| 31 | 31 | $chunkSize = hexdec(trim($temp)); |
| 32 | 32 | $chunkStart = $chunkEnd; |
| 33 | - while ($chunkSize > 0) { |
|
| 34 | - $chunkEnd = strpos($buffer, "\r\n", $chunkStart + $chunkSize); |
|
| 33 | + while ($chunkSize>0) { |
|
| 34 | + $chunkEnd = strpos($buffer, "\r\n", $chunkStart+$chunkSize); |
|
| 35 | 35 | |
| 36 | 36 | // just in case we got a broken connection |
| 37 | 37 | if ($chunkEnd == false) { |
@@ -43,19 +43,19 @@ discard block |
||
| 43 | 43 | } |
| 44 | 44 | |
| 45 | 45 | // read chunk-data and crlf |
| 46 | - $chunk = substr($buffer, $chunkStart, $chunkEnd - $chunkStart); |
|
| 46 | + $chunk = substr($buffer, $chunkStart, $chunkEnd-$chunkStart); |
|
| 47 | 47 | // append chunk-data to entity-body |
| 48 | 48 | $new .= $chunk; |
| 49 | 49 | // length := length + chunk-size |
| 50 | 50 | $length += strlen($chunk); |
| 51 | 51 | // read chunk-size and crlf |
| 52 | - $chunkStart = $chunkEnd + 2; |
|
| 52 | + $chunkStart = $chunkEnd+2; |
|
| 53 | 53 | |
| 54 | - $chunkEnd = strpos($buffer, "\r\n", $chunkStart) + 2; |
|
| 54 | + $chunkEnd = strpos($buffer, "\r\n", $chunkStart)+2; |
|
| 55 | 55 | if ($chunkEnd == false) { |
| 56 | 56 | break; // just in case we got a broken connection |
| 57 | 57 | } |
| 58 | - $temp = substr($buffer, $chunkStart, $chunkEnd - $chunkStart); |
|
| 58 | + $temp = substr($buffer, $chunkStart, $chunkEnd-$chunkStart); |
|
| 59 | 59 | $chunkSize = hexdec(trim($temp)); |
| 60 | 60 | $chunkStart = $chunkEnd; |
| 61 | 61 | } |
@@ -84,11 +84,11 @@ discard block |
||
| 84 | 84 | // Look for CR/LF or simple LF as line separator (even though it is not valid http) |
| 85 | 85 | $pos = strpos($data, "\r\n\r\n"); |
| 86 | 86 | if ($pos || is_int($pos)) { |
| 87 | - $bd = $pos + 4; |
|
| 87 | + $bd = $pos+4; |
|
| 88 | 88 | } else { |
| 89 | 89 | $pos = strpos($data, "\n\n"); |
| 90 | 90 | if ($pos || is_int($pos)) { |
| 91 | - $bd = $pos + 2; |
|
| 91 | + $bd = $pos+2; |
|
| 92 | 92 | } else { |
| 93 | 93 | // No separation between response headers and body: fault? |
| 94 | 94 | $bd = 0; |
@@ -98,8 +98,8 @@ discard block |
||
| 98 | 98 | // this filters out all http headers from proxy. maybe we could take them into account, too? |
| 99 | 99 | $data = substr($data, $bd); |
| 100 | 100 | } else { |
| 101 | - $this->getLogger()->error('XML-RPC: ' . __METHOD__ . ': HTTPS via proxy error, tunnel connection possibly failed'); |
|
| 102 | - throw new HttpException(PhpXmlRpc::$xmlrpcstr['http_error'] . ' (HTTPS via proxy error, tunnel connection possibly failed)', PhpXmlRpc::$xmlrpcerr['http_error']); |
|
| 101 | + $this->getLogger()->error('XML-RPC: '.__METHOD__.': HTTPS via proxy error, tunnel connection possibly failed'); |
|
| 102 | + throw new HttpException(PhpXmlRpc::$xmlrpcstr['http_error'].' (HTTPS via proxy error, tunnel connection possibly failed)', PhpXmlRpc::$xmlrpcerr['http_error']); |
|
| 103 | 103 | } |
| 104 | 104 | } |
| 105 | 105 | |
@@ -132,19 +132,19 @@ discard block |
||
| 132 | 132 | } |
| 133 | 133 | |
| 134 | 134 | if ($httpResponse['status_code'] !== '200') { |
| 135 | - $errstr = substr($data, 0, strpos($data, "\n") - 1); |
|
| 136 | - $this->getLogger()->error('XML-RPC: ' . __METHOD__ . ': HTTP error, got response: ' . $errstr); |
|
| 137 | - throw new HttpException(PhpXmlRpc::$xmlrpcstr['http_error'] . ' (' . $errstr . ')', PhpXmlRpc::$xmlrpcerr['http_error'], null, $httpResponse['status_code']); |
|
| 135 | + $errstr = substr($data, 0, strpos($data, "\n")-1); |
|
| 136 | + $this->getLogger()->error('XML-RPC: '.__METHOD__.': HTTP error, got response: '.$errstr); |
|
| 137 | + throw new HttpException(PhpXmlRpc::$xmlrpcstr['http_error'].' ('.$errstr.')', PhpXmlRpc::$xmlrpcerr['http_error'], null, $httpResponse['status_code']); |
|
| 138 | 138 | } |
| 139 | 139 | |
| 140 | 140 | // be tolerant to usage of \n instead of \r\n to separate headers and data (even though it is not valid http) |
| 141 | 141 | $pos = strpos($data, "\r\n\r\n"); |
| 142 | 142 | if ($pos || is_int($pos)) { |
| 143 | - $bd = $pos + 4; |
|
| 143 | + $bd = $pos+4; |
|
| 144 | 144 | } else { |
| 145 | 145 | $pos = strpos($data, "\n\n"); |
| 146 | 146 | if ($pos || is_int($pos)) { |
| 147 | - $bd = $pos + 2; |
|
| 147 | + $bd = $pos+2; |
|
| 148 | 148 | } else { |
| 149 | 149 | // No separation between response headers and body: fault? |
| 150 | 150 | // we could take some action here instead of going on... |
@@ -158,7 +158,7 @@ discard block |
||
| 158 | 158 | foreach ($ar as $line) { |
| 159 | 159 | // take care of (multi-line) headers and cookies |
| 160 | 160 | $arr = explode(':', $line, 2); |
| 161 | - if (count($arr) > 1) { |
|
| 161 | + if (count($arr)>1) { |
|
| 162 | 162 | /// @todo according to https://www.rfc-editor.org/rfc/rfc7230#section-3.2.4, we should reject with error |
| 163 | 163 | /// 400 any messages where a space is present between the header name and colon |
| 164 | 164 | $headerName = strtolower(trim($arr[0])); |
@@ -166,7 +166,7 @@ discard block |
||
| 166 | 166 | $cookie = $arr[1]; |
| 167 | 167 | // glue together all received cookies, using a comma to separate them (same as php does with getallheaders()) |
| 168 | 168 | if (isset($httpResponse['headers'][$headerName])) { |
| 169 | - $httpResponse['headers'][$headerName] .= ', ' . trim($cookie); |
|
| 169 | + $httpResponse['headers'][$headerName] .= ', '.trim($cookie); |
|
| 170 | 170 | } else { |
| 171 | 171 | $httpResponse['headers'][$headerName] = trim($cookie); |
| 172 | 172 | } |
@@ -197,7 +197,7 @@ discard block |
||
| 197 | 197 | } elseif (isset($headerName)) { |
| 198 | 198 | /// @todo improve this: 1. check that the line starts with a space or tab; 2. according to |
| 199 | 199 | /// https://www.rfc-editor.org/rfc/rfc7230#section-3.2.4, we should flat out refuse these messages |
| 200 | - $httpResponse['headers'][$headerName] .= ' ' . trim($line); |
|
| 200 | + $httpResponse['headers'][$headerName] .= ' '.trim($line); |
|
| 201 | 201 | } |
| 202 | 202 | } |
| 203 | 203 | |
@@ -220,7 +220,7 @@ discard block |
||
| 220 | 220 | // Decode chunked encoding sent by http 1.1 servers |
| 221 | 221 | if (isset($httpResponse['headers']['transfer-encoding']) && $httpResponse['headers']['transfer-encoding'] == 'chunked') { |
| 222 | 222 | if (!$data = static::decodeChunked($data)) { |
| 223 | - $this->getLogger()->error('XML-RPC: ' . __METHOD__ . ': errors occurred when trying to rebuild the chunked data received from server'); |
|
| 223 | + $this->getLogger()->error('XML-RPC: '.__METHOD__.': errors occurred when trying to rebuild the chunked data received from server'); |
|
| 224 | 224 | throw new HttpException(PhpXmlRpc::$xmlrpcstr['dechunk_fail'], PhpXmlRpc::$xmlrpcerr['dechunk_fail'], null, $httpResponse['status_code']); |
| 225 | 225 | } |
| 226 | 226 | } |
@@ -235,19 +235,19 @@ discard block |
||
| 235 | 235 | if ($httpResponse['headers']['content-encoding'] == 'deflate' && $degzdata = @gzuncompress($data)) { |
| 236 | 236 | $data = $degzdata; |
| 237 | 237 | if ($debug) { |
| 238 | - $this->getLogger()->debug("---INFLATED RESPONSE---[" . strlen($data) . " chars]---\n$data\n---END---"); |
|
| 238 | + $this->getLogger()->debug("---INFLATED RESPONSE---[".strlen($data)." chars]---\n$data\n---END---"); |
|
| 239 | 239 | } |
| 240 | 240 | } elseif ($httpResponse['headers']['content-encoding'] == 'gzip' && $degzdata = @gzinflate(substr($data, 10))) { |
| 241 | 241 | $data = $degzdata; |
| 242 | 242 | if ($debug) { |
| 243 | - $this->getLogger()->debug("---INFLATED RESPONSE---[" . strlen($data) . " chars]---\n$data\n---END---"); |
|
| 243 | + $this->getLogger()->debug("---INFLATED RESPONSE---[".strlen($data)." chars]---\n$data\n---END---"); |
|
| 244 | 244 | } |
| 245 | 245 | } else { |
| 246 | - $this->getLogger()->error('XML-RPC: ' . __METHOD__ . ': errors occurred when trying to decode the deflated data received from server'); |
|
| 246 | + $this->getLogger()->error('XML-RPC: '.__METHOD__.': errors occurred when trying to decode the deflated data received from server'); |
|
| 247 | 247 | throw new HttpException(PhpXmlRpc::$xmlrpcstr['decompress_fail'], PhpXmlRpc::$xmlrpcerr['decompress_fail'], null, $httpResponse['status_code']); |
| 248 | 248 | } |
| 249 | 249 | } else { |
| 250 | - $this->getLogger()->error('XML-RPC: ' . __METHOD__ . ': the server sent deflated data. Your php install must have the Zlib extension compiled in to support this.'); |
|
| 250 | + $this->getLogger()->error('XML-RPC: '.__METHOD__.': the server sent deflated data. Your php install must have the Zlib extension compiled in to support this.'); |
|
| 251 | 251 | throw new HttpException(PhpXmlRpc::$xmlrpcstr['cannot_decompress'], PhpXmlRpc::$xmlrpcerr['cannot_decompress'], null, $httpResponse['status_code']); |
| 252 | 252 | } |
| 253 | 253 | } |
@@ -267,7 +267,7 @@ discard block |
||
| 267 | 267 | public function parseAcceptHeader($header) |
| 268 | 268 | { |
| 269 | 269 | $accepted = array(); |
| 270 | - foreach(explode(',', $header) as $c) { |
|
| 270 | + foreach (explode(',', $header) as $c) { |
|
| 271 | 271 | if (preg_match('/^([^;]+); *q=([0-9.]+)/', $c, $matches)) { |
| 272 | 272 | $c = $matches[1]; |
| 273 | 273 | $w = $matches[2]; |
@@ -1,6 +1,6 @@ |
||
| 1 | 1 | <?php |
| 2 | 2 | |
| 3 | -include_once __DIR__ . '/LoggerAwareTestCase.php'; |
|
| 3 | +include_once __DIR__.'/LoggerAwareTestCase.php'; |
|
| 4 | 4 | |
| 5 | 5 | /** |
| 6 | 6 | * Tests involving Requests and Responses, except for the parsing part |
@@ -1,6 +1,6 @@ discard block |
||
| 1 | 1 | <?php |
| 2 | 2 | |
| 3 | -include_once __DIR__ . '/LoggerAwareTestCase.php'; |
|
| 3 | +include_once __DIR__.'/LoggerAwareTestCase.php'; |
|
| 4 | 4 | |
| 5 | 5 | /** |
| 6 | 6 | * Tests involving automatic encoding/decoding of php values into xmlrpc values (the Encoder class). |
@@ -75,7 +75,7 @@ discard block |
||
| 75 | 75 | /// @todo it seems that old php versions can not automatically transform latin to utf8 upon xml parsing. |
| 76 | 76 | /// We should fix that, then re-enable this test |
| 77 | 77 | if (version_compare(PHP_VERSION, '5.6.0', '>=')) { |
| 78 | - $i = $e->decodeXml('<?xml version="1.0" encoding="ISO-8859-15" ?><value><string>' . $string . '</string></value>'); |
|
| 78 | + $i = $e->decodeXml('<?xml version="1.0" encoding="ISO-8859-15" ?><value><string>'.$string.'</string></value>'); |
|
| 79 | 79 | $this->assertEquals($string, $i->scalarVal()); |
| 80 | 80 | } |
| 81 | 81 | |
@@ -1,6 +1,6 @@ discard block |
||
| 1 | 1 | <?php |
| 2 | 2 | |
| 3 | -include_once __DIR__ . '/LoggerAwareTestCase.php'; |
|
| 3 | +include_once __DIR__.'/LoggerAwareTestCase.php'; |
|
| 4 | 4 | |
| 5 | 5 | /** |
| 6 | 6 | * Tests involving the Client class (and no server). |
@@ -35,7 +35,7 @@ discard block |
||
| 35 | 35 | $this->client->server .= 'XXX'; |
| 36 | 36 | $dnsinfo = @dns_get_record($this->client->server); |
| 37 | 37 | if ($dnsinfo) { |
| 38 | - $this->markTestSkipped('Seems like there is a catchall DNS in effect: host ' . $this->client->server . ' found'); |
|
| 38 | + $this->markTestSkipped('Seems like there is a catchall DNS in effect: host '.$this->client->server.' found'); |
|
| 39 | 39 | } else { |
| 40 | 40 | $r = $this->client->send($m, 5); |
| 41 | 41 | // make sure there's no freaking catchall DNS in effect |
@@ -62,7 +62,7 @@ discard block |
||
| 62 | 62 | |
| 63 | 63 | // now test a successful connection |
| 64 | 64 | $server = explode(':', $this->args['HTTPSERVER']); |
| 65 | - if (count($server) > 1) { |
|
| 65 | + if (count($server)>1) { |
|
| 66 | 66 | $this->client->port = $server[1]; |
| 67 | 67 | } |
| 68 | 68 | $this->client->server = $server[0]; |
@@ -1,6 +1,6 @@ discard block |
||
| 1 | 1 | <?php |
| 2 | 2 | |
| 3 | -include_once __DIR__ . '/LoggerAwareTestCase.php'; |
|
| 3 | +include_once __DIR__.'/LoggerAwareTestCase.php'; |
|
| 4 | 4 | |
| 5 | 5 | /** |
| 6 | 6 | * Tests involving the Value class. |
@@ -155,7 +155,7 @@ discard block |
||
| 155 | 155 | $this->assertequals(1, count($v1)); |
| 156 | 156 | $out = array('me' => array(), 'mytype' => 2, '_php_class' => null); |
| 157 | 157 | |
| 158 | - foreach($v1 as $key => $val) |
|
| 158 | + foreach ($v1 as $key => $val) |
|
| 159 | 159 | { |
| 160 | 160 | $this->assertArrayHasKey($key, $out); |
| 161 | 161 | $expected = $out[$key]; |
@@ -170,7 +170,7 @@ discard block |
||
| 170 | 170 | $this->assertequals(2, count($v2)); |
| 171 | 171 | $out = array(array('key' => 0, 'value' => 'object'), array('key' => 1, 'value' => 'object')); |
| 172 | 172 | $i = 0; |
| 173 | - foreach($v2 as $key => $val) |
|
| 173 | + foreach ($v2 as $key => $val) |
|
| 174 | 174 | { |
| 175 | 175 | $expected = $out[$i]; |
| 176 | 176 | $this->assertequals($expected['key'], $key); |
@@ -184,7 +184,7 @@ discard block |
||
| 184 | 184 | { |
| 185 | 185 | // nb: make sure that the serialized xml corresponding to this is > 10MB in size |
| 186 | 186 | $data = array(); |
| 187 | - for ($i = 0; $i < 500000; $i++ ) { |
|
| 187 | + for ($i = 0; $i<500000; $i++) { |
|
| 188 | 188 | $data[] = 'hello world'; |
| 189 | 189 | } |
| 190 | 190 | |
@@ -1,6 +1,6 @@ discard block |
||
| 1 | 1 | <?php |
| 2 | 2 | |
| 3 | -include_once __DIR__ . '/LoggerAwareTestCase.php'; |
|
| 3 | +include_once __DIR__.'/LoggerAwareTestCase.php'; |
|
| 4 | 4 | |
| 5 | 5 | /** |
| 6 | 6 | * Tests involving xml parsing. |
@@ -101,7 +101,7 @@ discard block |
||
| 101 | 101 | |
| 102 | 102 | public function testI8() |
| 103 | 103 | { |
| 104 | - if (PHP_INT_SIZE == 4 ) { |
|
| 104 | + if (PHP_INT_SIZE == 4) { |
|
| 105 | 105 | $this->markTestSkipped('Can not test i8 as php is compiled in 32 bit mode'); |
| 106 | 106 | return; |
| 107 | 107 | } |
@@ -176,7 +176,7 @@ discard block |
||
| 176 | 176 | |
| 177 | 177 | public function testUnicodeInMemberName() |
| 178 | 178 | { |
| 179 | - $str = "G" . chr(252) . "nter, El" . chr(232) . "ne"; |
|
| 179 | + $str = "G".chr(252)."nter, El".chr(232)."ne"; |
|
| 180 | 180 | $v = array($str => new xmlrpcval(1)); |
| 181 | 181 | $r = new xmlrpcresp(new xmlrpcval($v, 'struct')); |
| 182 | 182 | $r = $r->serialize(); |
@@ -192,7 +192,7 @@ discard block |
||
| 192 | 192 | $response = @utf8_encode( |
| 193 | 193 | '<?xml version="1.0"?> |
| 194 | 194 | <!-- covers what happens when lib receives UTF8 chars in response text and comments --> |
| 195 | -<!-- ' . chr(224) . chr(252) . chr(232) . 'àüè --> |
|
| 195 | +<!-- ' . chr(224).chr(252).chr(232).'àüè --> |
|
| 196 | 196 | <methodResponse> |
| 197 | 197 | <fault> |
| 198 | 198 | <value> |
@@ -203,7 +203,7 @@ discard block |
||
| 203 | 203 | </member> |
| 204 | 204 | <member> |
| 205 | 205 | <name>faultString</name> |
| 206 | -<value><string>' . chr(224) . chr(252) . chr(232) . 'àüè</string></value> |
|
| 206 | +<value><string>' . chr(224).chr(252).chr(232).'àüè</string></value> |
|
| 207 | 207 | </member> |
| 208 | 208 | </struct> |
| 209 | 209 | </value> |
@@ -212,7 +212,7 @@ discard block |
||
| 212 | 212 | $m = $this->newRequest('dummy'); |
| 213 | 213 | $r = $m->parseResponse($response); |
| 214 | 214 | $v = $r->faultString(); |
| 215 | - $this->assertEquals(chr(224) . chr(252) . chr(232) . chr(224) . chr(252) . chr(232), $v); |
|
| 215 | + $this->assertEquals(chr(224).chr(252).chr(232).chr(224).chr(252).chr(232), $v); |
|
| 216 | 216 | } |
| 217 | 217 | |
| 218 | 218 | public function testBrokenRequests() |
@@ -419,8 +419,8 @@ discard block |
||
| 419 | 419 | $i = \PhpXmlRpc\PhpXmlRpc::$xmlrpc_reject_invalid_values; |
| 420 | 420 | \PhpXmlRpc\PhpXmlRpc::$xmlrpc_reject_invalid_values = true; |
| 421 | 421 | |
| 422 | - foreach($values as $value) { |
|
| 423 | - $f = '<?xml version="1.0"?><methodResponse><params><param><value>' . $value . '</value></param></params></methodResponse> '; |
|
| 422 | + foreach ($values as $value) { |
|
| 423 | + $f = '<?xml version="1.0"?><methodResponse><params><param><value>'.$value.'</value></param></params></methodResponse> '; |
|
| 424 | 424 | $r = $s->parseResponse($f); |
| 425 | 425 | $v = $r->faultCode(); |
| 426 | 426 | $this->assertEquals(2, $v, "Testing $value"); |
@@ -524,11 +524,11 @@ discard block |
||
| 524 | 524 | |
| 525 | 525 | public function testUTF8Response() |
| 526 | 526 | { |
| 527 | - $string = chr(224) . chr(252) . chr(232); |
|
| 527 | + $string = chr(224).chr(252).chr(232); |
|
| 528 | 528 | |
| 529 | 529 | $s = $this->newRequest('dummy'); |
| 530 | - $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> |
|
| 531 | -<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> |
|
| 530 | + $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> |
|
| 531 | +<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> |
|
| 532 | 532 | '; |
| 533 | 533 | $r = $s->parseResponse($f, false, 'phpvals'); |
| 534 | 534 | $v = $r->value(); |
@@ -536,7 +536,7 @@ discard block |
||
| 536 | 536 | $this->assertEquals($string, $v); |
| 537 | 537 | |
| 538 | 538 | $f = '<?xml version="1.0" encoding="UTF-8"?><methodResponse><params><param><value><struct><member><name>userid</name><value>311127</value></member> |
| 539 | -<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> |
|
| 539 | +<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> |
|
| 540 | 540 | '; |
| 541 | 541 | $r = $s->parseResponse($f, false, 'phpvals'); |
| 542 | 542 | $v = $r->value(); |
@@ -552,11 +552,11 @@ discard block |
||
| 552 | 552 | |
| 553 | 553 | public function testLatin1Response() |
| 554 | 554 | { |
| 555 | - $string = chr(224) . chr(252) . chr(232); |
|
| 555 | + $string = chr(224).chr(252).chr(232); |
|
| 556 | 556 | |
| 557 | 557 | $s = $this->newRequest('dummy'); |
| 558 | - $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> |
|
| 559 | -<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> |
|
| 558 | + $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> |
|
| 559 | +<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> |
|
| 560 | 560 | '; |
| 561 | 561 | $r = $s->parseResponse($f, false, 'phpvals'); |
| 562 | 562 | $v = $r->value(); |
@@ -564,7 +564,7 @@ discard block |
||
| 564 | 564 | $this->assertEquals($string, $v); |
| 565 | 565 | |
| 566 | 566 | $f = '<?xml version="1.0" encoding="ISO-8859-1"?><methodResponse><params><param><value><struct><member><name>userid</name><value>311127</value></member> |
| 567 | -<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> |
|
| 567 | +<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> |
|
| 568 | 568 | '; |
| 569 | 569 | $r = $s->parseResponse($f, false, 'phpvals'); |
| 570 | 570 | $v = $r->value(); |
@@ -1,6 +1,6 @@ discard block |
||
| 1 | 1 | <?php |
| 2 | 2 | |
| 3 | -include_once __DIR__ . '/LoggerAwareTestCase.php'; |
|
| 3 | +include_once __DIR__.'/LoggerAwareTestCase.php'; |
|
| 4 | 4 | |
| 5 | 5 | use PHPUnit\Extensions\SeleniumCommon\RemoteCoverage; |
| 6 | 6 | use PHPUnit\Framework\TestResult; |
@@ -28,7 +28,7 @@ discard block |
||
| 28 | 28 | */ |
| 29 | 29 | public function _run($result = NULL) |
| 30 | 30 | { |
| 31 | - $this->testId = get_class($this) . '__' . $this->getName(); |
|
| 31 | + $this->testId = get_class($this).'__'.$this->getName(); |
|
| 32 | 32 | |
| 33 | 33 | if ($result === NULL) { |
| 34 | 34 | $result = $this->createResult(); |
@@ -59,7 +59,7 @@ discard block |
||
| 59 | 59 | parent::set_up(); |
| 60 | 60 | |
| 61 | 61 | // assumes HTTPURI to be in the form /tests/index.php?etc... |
| 62 | - $this->baseUrl = 'http://' . $this->args['HTTPSERVER'] . preg_replace('|\?.+|', '', $this->args['HTTPURI']); |
|
| 63 | - $this->coverageScriptUrl = 'http://' . $this->args['HTTPSERVER'] . preg_replace('|/tests/index\.php(\?.*)?|', '/tests/phpunit_coverage.php', $this->args['HTTPURI']); |
|
| 62 | + $this->baseUrl = 'http://'.$this->args['HTTPSERVER'].preg_replace('|\?.+|', '', $this->args['HTTPURI']); |
|
| 63 | + $this->coverageScriptUrl = 'http://'.$this->args['HTTPSERVER'].preg_replace('|/tests/index\.php(\?.*)?|', '/tests/phpunit_coverage.php', $this->args['HTTPURI']); |
|
| 64 | 64 | } |
| 65 | 65 | } |
@@ -1,5 +1,5 @@ discard block |
||
| 1 | 1 | <?php |
| 2 | -require_once __DIR__ . "/_prepend.php"; |
|
| 2 | +require_once __DIR__."/_prepend.php"; |
|
| 3 | 3 | |
| 4 | 4 | use PhpXmlRpc\Encoder; |
| 5 | 5 | use PhpXmlRpc\Client; |
@@ -26,7 +26,7 @@ discard block |
||
| 26 | 26 | $handles = array(); |
| 27 | 27 | $curl = curl_multi_init(); |
| 28 | 28 | |
| 29 | - foreach($requests as $k => $req) { |
|
| 29 | + foreach ($requests as $k => $req) { |
|
| 30 | 30 | $req->setDebug($this->debug); |
| 31 | 31 | |
| 32 | 32 | $handle = $this->prepareCurlHandle( |
@@ -59,19 +59,19 @@ discard block |
||
| 59 | 59 | $running = 0; |
| 60 | 60 | do { |
| 61 | 61 | curl_multi_exec($curl, $running); |
| 62 | - } while($running > 0); |
|
| 62 | + } while ($running>0); |
|
| 63 | 63 | |
| 64 | 64 | $responses = array(); |
| 65 | - foreach($handles as $k => $h) { |
|
| 65 | + foreach ($handles as $k => $h) { |
|
| 66 | 66 | $responses[$k] = curl_multi_getcontent($handles[$k]); |
| 67 | 67 | |
| 68 | - if ($this->debug > 1) { |
|
| 68 | + if ($this->debug>1) { |
|
| 69 | 69 | $message = "---CURL INFO---\n"; |
| 70 | 70 | foreach (curl_getinfo($h) as $name => $val) { |
| 71 | 71 | if (is_array($val)) { |
| 72 | 72 | $val = implode("\n", $val); |
| 73 | 73 | } |
| 74 | - $message .= $name . ': ' . $val . "\n"; |
|
| 74 | + $message .= $name.': '.$val."\n"; |
|
| 75 | 75 | } |
| 76 | 76 | $message .= '---END---'; |
| 77 | 77 | $this->getLogger()->debugMessage($message); |
@@ -82,9 +82,9 @@ discard block |
||
| 82 | 82 | } |
| 83 | 83 | curl_multi_close($curl); |
| 84 | 84 | |
| 85 | - foreach($responses as $k => $resp) { |
|
| 85 | + foreach ($responses as $k => $resp) { |
|
| 86 | 86 | if (!$resp) { |
| 87 | - $responses[$k] = new Response(0, PhpXmlRpc::$xmlrpcerr['curl_fail'], PhpXmlRpc::$xmlrpcstr['curl_fail'] . ': ' . curl_error($curl)); |
|
| 87 | + $responses[$k] = new Response(0, PhpXmlRpc::$xmlrpcerr['curl_fail'], PhpXmlRpc::$xmlrpcstr['curl_fail'].': '.curl_error($curl)); |
|
| 88 | 88 | } else { |
| 89 | 89 | $responses[$k] = $requests[$k]->parseResponse($resp, true, $this->return_type); |
| 90 | 90 | } |
@@ -101,12 +101,12 @@ discard block |
||
| 101 | 101 | $value = $encoder->encode($data, array('auto_dates')); |
| 102 | 102 | $req = new Request('interopEchoTests.echoValue', array($value)); |
| 103 | 103 | $reqs = array(); |
| 104 | -for ($i = 0; $i < $num_tests; $i++) { |
|
| 104 | +for ($i = 0; $i<$num_tests; $i++) { |
|
| 105 | 105 | $reqs[] = $req; |
| 106 | 106 | } |
| 107 | 107 | |
| 108 | 108 | $client = new ParallelClient(XMLRPCSERVER); |
| 109 | -$client->setOption(Client::OPT_NO_MULTICALL, true); |
|
| 109 | +$client->setOption(Client::OPT_NO_MULTICALL, true); |
|
| 110 | 110 | |
| 111 | 111 | // a minimal benchmark - use 3 strategies to execute the same 25 calls: sequentially, using parallel http requests, and |
| 112 | 112 | // using a single system.multiCall request |
@@ -116,18 +116,18 @@ discard block |
||
| 116 | 116 | |
| 117 | 117 | $t = microtime(true); |
| 118 | 118 | $resp = $client->send($reqs); |
| 119 | -$t = microtime(true) - $t; |
|
| 120 | -echo "Sequential send: " . sprintf('%.3f', $t) . " secs.\n"; |
|
| 119 | +$t = microtime(true)-$t; |
|
| 120 | +echo "Sequential send: ".sprintf('%.3f', $t)." secs.\n"; |
|
| 121 | 121 | flush(); |
| 122 | 122 | |
| 123 | 123 | $t = microtime(true); |
| 124 | 124 | $resp = $client->sendParallel($reqs); |
| 125 | -$t = microtime(true) - $t; |
|
| 126 | -echo "Parallel send: " . sprintf('%.3f', $t) . " secs.\n"; |
|
| 125 | +$t = microtime(true)-$t; |
|
| 126 | +echo "Parallel send: ".sprintf('%.3f', $t)." secs.\n"; |
|
| 127 | 127 | flush(); |
| 128 | 128 | |
| 129 | 129 | $client->setOption(Client::OPT_NO_MULTICALL, false); |
| 130 | 130 | $t = microtime(true); |
| 131 | 131 | $resp = $client->send($reqs); |
| 132 | -$t = microtime(true) - $t; |
|
| 133 | -echo "Multicall send: " . sprintf('%.3f', $t) . " secs.\n"; |
|
| 132 | +$t = microtime(true)-$t; |
|
| 133 | +echo "Multicall send: ".sprintf('%.3f', $t)." secs.\n"; |
|
@@ -1,5 +1,5 @@ discard block |
||
| 1 | 1 | <?php |
| 2 | -require_once __DIR__ . "/_prepend.php"; |
|
| 2 | +require_once __DIR__."/_prepend.php"; |
|
| 3 | 3 | |
| 4 | 4 | output('<html lang="en"> |
| 5 | 5 | <head><title>phpxmlrpc - Introspect demo</title></head> |
@@ -17,7 +17,7 @@ discard block |
||
| 17 | 17 | function display_error($r) |
| 18 | 18 | { |
| 19 | 19 | output("An error occurred: "); |
| 20 | - output("Code: " . $r->faultCode() . " Reason: '" . $r->faultString() . "'<br/>"); |
|
| 20 | + output("Code: ".$r->faultCode()." Reason: '".$r->faultString()."'<br/>"); |
|
| 21 | 21 | } |
| 22 | 22 | |
| 23 | 23 | $client = new Client(XMLRPCSERVER); |
@@ -25,7 +25,7 @@ discard block |
||
| 25 | 25 | $client->setOption(Client::OPT_RETURN_TYPE, XMLRPCParser::RETURN_PHP); |
| 26 | 26 | |
| 27 | 27 | // First off, let's retrieve the list of methods available on the remote server |
| 28 | -output("<h3>methods available at http://" . $client->server . $client->path . "</h3>\n"); |
|
| 28 | +output("<h3>methods available at http://".$client->server.$client->path."</h3>\n"); |
|
| 29 | 29 | $req = new Request('system.listMethods'); |
| 30 | 30 | $resp = $client->send($req); |
| 31 | 31 | |
@@ -47,7 +47,7 @@ discard block |
||
| 47 | 47 | |
| 48 | 48 | // Then, retrieve the signature and help text of each available method |
| 49 | 49 | foreach ($v as $methodName) { |
| 50 | - output("<h4>" . htmlspecialchars($methodName) . "</h4>\n"); |
|
| 50 | + output("<h4>".htmlspecialchars($methodName)."</h4>\n"); |
|
| 51 | 51 | // build requests first, add params later |
| 52 | 52 | $r1 = new PhpXmlRpc\Request('system.methodHelp'); |
| 53 | 53 | $r2 = new PhpXmlRpc\Request('system.methodSignature'); |
@@ -83,12 +83,12 @@ discard block |
||
| 83 | 83 | continue; |
| 84 | 84 | } |
| 85 | 85 | $ret = $sig[0]; |
| 86 | - output("<code>" . htmlspecialchars($ret) . " " |
|
| 87 | - . htmlspecialchars($methodName) . "("); |
|
| 88 | - if (count($sig) > 1) { |
|
| 89 | - for ($k = 1; $k < count($sig); $k++) { |
|
| 86 | + output("<code>".htmlspecialchars($ret)." " |
|
| 87 | + . htmlspecialchars($methodName)."("); |
|
| 88 | + if (count($sig)>1) { |
|
| 89 | + for ($k = 1; $k<count($sig); $k++) { |
|
| 90 | 90 | output(htmlspecialchars($sig[$k])); |
| 91 | - if ($k < count($sig) - 1) { |
|
| 91 | + if ($k<count($sig)-1) { |
|
| 92 | 92 | output(", "); |
| 93 | 93 | } |
| 94 | 94 | } |