@@ -24,12 +24,12 @@ discard block |
||
24 | 24 | |
25 | 25 | // read chunk-size, chunk-extension (if any) and crlf |
26 | 26 | // get the position of the linebreak |
27 | - $chunkEnd = strpos($buffer, "\r\n") + 2; |
|
27 | + $chunkEnd = strpos($buffer, "\r\n")+2; |
|
28 | 28 | $temp = substr($buffer, 0, $chunkEnd); |
29 | 29 | $chunkSize = hexdec(trim($temp)); |
30 | 30 | $chunkStart = $chunkEnd; |
31 | - while ($chunkSize > 0) { |
|
32 | - $chunkEnd = strpos($buffer, "\r\n", $chunkStart + $chunkSize); |
|
31 | + while ($chunkSize>0) { |
|
32 | + $chunkEnd = strpos($buffer, "\r\n", $chunkStart+$chunkSize); |
|
33 | 33 | |
34 | 34 | // just in case we got a broken connection |
35 | 35 | if ($chunkEnd == false) { |
@@ -41,19 +41,19 @@ discard block |
||
41 | 41 | } |
42 | 42 | |
43 | 43 | // read chunk-data and crlf |
44 | - $chunk = substr($buffer, $chunkStart, $chunkEnd - $chunkStart); |
|
44 | + $chunk = substr($buffer, $chunkStart, $chunkEnd-$chunkStart); |
|
45 | 45 | // append chunk-data to entity-body |
46 | 46 | $new .= $chunk; |
47 | 47 | // length := length + chunk-size |
48 | 48 | $length += strlen($chunk); |
49 | 49 | // read chunk-size and crlf |
50 | - $chunkStart = $chunkEnd + 2; |
|
50 | + $chunkStart = $chunkEnd+2; |
|
51 | 51 | |
52 | - $chunkEnd = strpos($buffer, "\r\n", $chunkStart) + 2; |
|
52 | + $chunkEnd = strpos($buffer, "\r\n", $chunkStart)+2; |
|
53 | 53 | if ($chunkEnd == false) { |
54 | 54 | break; //just in case we got a broken connection |
55 | 55 | } |
56 | - $temp = substr($buffer, $chunkStart, $chunkEnd - $chunkStart); |
|
56 | + $temp = substr($buffer, $chunkStart, $chunkEnd-$chunkStart); |
|
57 | 57 | $chunkSize = hexdec(trim($temp)); |
58 | 58 | $chunkStart = $chunkEnd; |
59 | 59 | } |
@@ -70,7 +70,7 @@ discard block |
||
70 | 70 | * @return array with keys 'headers', 'cookies', 'raw_data' and 'status_code' |
71 | 71 | * @throws HttpException |
72 | 72 | */ |
73 | - public function parseResponseHeaders(&$data, $headersProcessed = false, $debug=0) |
|
73 | + public function parseResponseHeaders(&$data, $headersProcessed = false, $debug = 0) |
|
74 | 74 | { |
75 | 75 | $httpResponse = array('raw_data' => $data, 'headers'=> array(), 'cookies' => array(), 'status_code' => null); |
76 | 76 | |
@@ -80,11 +80,11 @@ discard block |
||
80 | 80 | // (even though it is not valid http) |
81 | 81 | $pos = strpos($data, "\r\n\r\n"); |
82 | 82 | if ($pos || is_int($pos)) { |
83 | - $bd = $pos + 4; |
|
83 | + $bd = $pos+4; |
|
84 | 84 | } else { |
85 | 85 | $pos = strpos($data, "\n\n"); |
86 | 86 | if ($pos || is_int($pos)) { |
87 | - $bd = $pos + 2; |
|
87 | + $bd = $pos+2; |
|
88 | 88 | } else { |
89 | 89 | // No separation between response headers and body: fault? |
90 | 90 | $bd = 0; |
@@ -95,8 +95,8 @@ discard block |
||
95 | 95 | // maybe we could take them into account, too? |
96 | 96 | $data = substr($data, $bd); |
97 | 97 | } else { |
98 | - Logger::instance()->errorLog('XML-RPC: ' . __METHOD__ . ': HTTPS via proxy error, tunnel connection possibly failed'); |
|
99 | - throw new HttpException(PhpXmlRpc::$xmlrpcstr['http_error'] . ' (HTTPS via proxy error, tunnel connection possibly failed)', PhpXmlRpc::$xmlrpcerr['http_error']); |
|
98 | + Logger::instance()->errorLog('XML-RPC: '.__METHOD__.': HTTPS via proxy error, tunnel connection possibly failed'); |
|
99 | + throw new HttpException(PhpXmlRpc::$xmlrpcstr['http_error'].' (HTTPS via proxy error, tunnel connection possibly failed)', PhpXmlRpc::$xmlrpcerr['http_error']); |
|
100 | 100 | } |
101 | 101 | } |
102 | 102 | |
@@ -126,20 +126,20 @@ discard block |
||
126 | 126 | } |
127 | 127 | |
128 | 128 | if ($httpResponse['status_code'] !== '200') { |
129 | - $errstr = substr($data, 0, strpos($data, "\n") - 1); |
|
130 | - Logger::instance()->errorLog('XML-RPC: ' . __METHOD__ . ': HTTP error, got response: ' . $errstr); |
|
131 | - throw new HttpException(PhpXmlRpc::$xmlrpcstr['http_error'] . ' (' . $errstr . ')', PhpXmlRpc::$xmlrpcerr['http_error'], null, $httpResponse['status_code'] ); |
|
129 | + $errstr = substr($data, 0, strpos($data, "\n")-1); |
|
130 | + Logger::instance()->errorLog('XML-RPC: '.__METHOD__.': HTTP error, got response: '.$errstr); |
|
131 | + throw new HttpException(PhpXmlRpc::$xmlrpcstr['http_error'].' ('.$errstr.')', PhpXmlRpc::$xmlrpcerr['http_error'], null, $httpResponse['status_code']); |
|
132 | 132 | } |
133 | 133 | |
134 | 134 | // be tolerant to usage of \n instead of \r\n to separate headers and data |
135 | 135 | // (even though it is not valid http) |
136 | 136 | $pos = strpos($data, "\r\n\r\n"); |
137 | 137 | if ($pos || is_int($pos)) { |
138 | - $bd = $pos + 4; |
|
138 | + $bd = $pos+4; |
|
139 | 139 | } else { |
140 | 140 | $pos = strpos($data, "\n\n"); |
141 | 141 | if ($pos || is_int($pos)) { |
142 | - $bd = $pos + 2; |
|
142 | + $bd = $pos+2; |
|
143 | 143 | } else { |
144 | 144 | // No separation between response headers and body: fault? |
145 | 145 | // we could take some action here instead of going on... |
@@ -150,10 +150,10 @@ discard block |
||
150 | 150 | // be tolerant to line endings, and extra empty lines |
151 | 151 | $ar = preg_split("/\r?\n/", trim(substr($data, 0, $pos))); |
152 | 152 | |
153 | - foreach($ar as $line) { |
|
153 | + foreach ($ar as $line) { |
|
154 | 154 | // take care of multi-line headers and cookies |
155 | 155 | $arr = explode(':', $line, 2); |
156 | - if (count($arr) > 1) { |
|
156 | + if (count($arr)>1) { |
|
157 | 157 | $headerName = strtolower(trim($arr[0])); |
158 | 158 | /// @todo some other headers (the ones that allow a CSV list of values) |
159 | 159 | /// do allow many values to be passed using multiple header lines. |
@@ -172,7 +172,7 @@ discard block |
||
172 | 172 | // glue together all received cookies, using a comma to separate them |
173 | 173 | // (same as php does with getallheaders()) |
174 | 174 | if (isset($httpResponse['headers'][$headerName])) { |
175 | - $httpResponse['headers'][$headerName] .= ', ' . trim($cookie); |
|
175 | + $httpResponse['headers'][$headerName] .= ', '.trim($cookie); |
|
176 | 176 | } else { |
177 | 177 | $httpResponse['headers'][$headerName] = trim($cookie); |
178 | 178 | } |
@@ -201,7 +201,7 @@ discard block |
||
201 | 201 | } |
202 | 202 | } elseif (isset($headerName)) { |
203 | 203 | /// @todo version1 cookies might span multiple lines, thus breaking the parsing above |
204 | - $httpResponse['headers'][$headerName] .= ' ' . trim($line); |
|
204 | + $httpResponse['headers'][$headerName] .= ' '.trim($line); |
|
205 | 205 | } |
206 | 206 | } |
207 | 207 | |
@@ -225,7 +225,7 @@ discard block |
||
225 | 225 | // Decode chunked encoding sent by http 1.1 servers |
226 | 226 | if (isset($httpResponse['headers']['transfer-encoding']) && $httpResponse['headers']['transfer-encoding'] == 'chunked') { |
227 | 227 | if (!$data = static::decodeChunked($data)) { |
228 | - Logger::instance()->errorLog('XML-RPC: ' . __METHOD__ . ': errors occurred when trying to rebuild the chunked data received from server'); |
|
228 | + Logger::instance()->errorLog('XML-RPC: '.__METHOD__.': errors occurred when trying to rebuild the chunked data received from server'); |
|
229 | 229 | throw new HttpException(PhpXmlRpc::$xmlrpcstr['dechunk_fail'], PhpXmlRpc::$xmlrpcerr['dechunk_fail'], null, $httpResponse['status_code']); |
230 | 230 | } |
231 | 231 | } |
@@ -240,19 +240,19 @@ discard block |
||
240 | 240 | if ($httpResponse['headers']['content-encoding'] == 'deflate' && $degzdata = @gzuncompress($data)) { |
241 | 241 | $data = $degzdata; |
242 | 242 | if ($debug) { |
243 | - Logger::instance()->debugMessage("---INFLATED RESPONSE---[" . strlen($data) . " chars]---\n$data\n---END---"); |
|
243 | + Logger::instance()->debugMessage("---INFLATED RESPONSE---[".strlen($data)." chars]---\n$data\n---END---"); |
|
244 | 244 | } |
245 | 245 | } elseif ($httpResponse['headers']['content-encoding'] == 'gzip' && $degzdata = @gzinflate(substr($data, 10))) { |
246 | 246 | $data = $degzdata; |
247 | 247 | if ($debug) { |
248 | - Logger::instance()->debugMessage("---INFLATED RESPONSE---[" . strlen($data) . " chars]---\n$data\n---END---"); |
|
248 | + Logger::instance()->debugMessage("---INFLATED RESPONSE---[".strlen($data)." chars]---\n$data\n---END---"); |
|
249 | 249 | } |
250 | 250 | } else { |
251 | - Logger::instance()->errorLog('XML-RPC: ' . __METHOD__ . ': errors occurred when trying to decode the deflated data received from server'); |
|
251 | + Logger::instance()->errorLog('XML-RPC: '.__METHOD__.': errors occurred when trying to decode the deflated data received from server'); |
|
252 | 252 | throw new HttpException(PhpXmlRpc::$xmlrpcstr['decompress_fail'], PhpXmlRpc::$xmlrpcerr['decompress_fail'], null, $httpResponse['status_code']); |
253 | 253 | } |
254 | 254 | } else { |
255 | - Logger::instance()->errorLog('XML-RPC: ' . __METHOD__ . ': the server sent deflated data. Your php install must have the Zlib extension compiled in to support this.'); |
|
255 | + Logger::instance()->errorLog('XML-RPC: '.__METHOD__.': the server sent deflated data. Your php install must have the Zlib extension compiled in to support this.'); |
|
256 | 256 | throw new HttpException(PhpXmlRpc::$xmlrpcstr['cannot_decompress'], PhpXmlRpc::$xmlrpcerr['cannot_decompress'], null, $httpResponse['status_code']); |
257 | 257 | } |
258 | 258 | } |
@@ -951,9 +951,9 @@ |
||
951 | 951 | } |
952 | 952 | |
953 | 953 | protected function prepareCurlHandle($req, $server, $port, $timeout = 0, $username = '', $password = '', |
954 | - $authType = 1, $cert = '', $certPass = '', $caCert = '', $caCertDir = '', $proxyHost = '', $proxyPort = 0, |
|
955 | - $proxyUsername = '', $proxyPassword = '', $proxyAuthType = 1, $method = 'https', $keepAlive = false, $key = '', |
|
956 | - $keyPass = '', $sslVersion = 0) |
|
954 | + $authType = 1, $cert = '', $certPass = '', $caCert = '', $caCertDir = '', $proxyHost = '', $proxyPort = 0, |
|
955 | + $proxyUsername = '', $proxyPassword = '', $proxyAuthType = 1, $method = 'https', $keepAlive = false, $key = '', |
|
956 | + $keyPass = '', $sslVersion = 0) |
|
957 | 957 | { |
958 | 958 | if ($port == 0) { |
959 | 959 | if (in_array($method, array('http', 'http10', 'http11', 'h2c'))) { |
@@ -157,10 +157,10 @@ discard block |
||
157 | 157 | $server = $parts['host']; |
158 | 158 | $path = isset($parts['path']) ? $parts['path'] : ''; |
159 | 159 | if (isset($parts['query'])) { |
160 | - $path .= '?' . $parts['query']; |
|
160 | + $path .= '?'.$parts['query']; |
|
161 | 161 | } |
162 | 162 | if (isset($parts['fragment'])) { |
163 | - $path .= '#' . $parts['fragment']; |
|
163 | + $path .= '#'.$parts['fragment']; |
|
164 | 164 | } |
165 | 165 | if (isset($parts['port'])) { |
166 | 166 | $port = $parts['port']; |
@@ -176,7 +176,7 @@ discard block |
||
176 | 176 | } |
177 | 177 | } |
178 | 178 | if ($path == '' || $path[0] != '/') { |
179 | - $this->path = '/' . $path; |
|
179 | + $this->path = '/'.$path; |
|
180 | 180 | } else { |
181 | 181 | $this->path = $path; |
182 | 182 | } |
@@ -214,7 +214,7 @@ discard block |
||
214 | 214 | }*/ |
215 | 215 | |
216 | 216 | // initialize user_agent string |
217 | - $this->user_agent = PhpXmlRpc::$xmlrpcName . ' ' . PhpXmlRpc::$xmlrpcVersion; |
|
217 | + $this->user_agent = PhpXmlRpc::$xmlrpcName.' '.PhpXmlRpc::$xmlrpcVersion; |
|
218 | 218 | } |
219 | 219 | |
220 | 220 | /** |
@@ -592,7 +592,7 @@ discard block |
||
592 | 592 | */ |
593 | 593 | protected function sendPayloadHTTP10($req, $server, $port, $timeout = 0, $username = '', $password = '', |
594 | 594 | $authType = 1, $proxyHost = '', $proxyPort = 0, $proxyUsername = '', $proxyPassword = '', $proxyAuthType = 1, |
595 | - $method='http') |
|
595 | + $method = 'http') |
|
596 | 596 | { |
597 | 597 | //trigger_error('Method ' . __METHOD__ . ' is deprecated', E_USER_DEPRECATED); |
598 | 598 | |
@@ -624,7 +624,7 @@ discard block |
||
624 | 624 | * @param int $sslVersion |
625 | 625 | * @return Response |
626 | 626 | */ |
627 | - protected function sendPayloadHTTPS($req, $server, $port, $timeout = 0, $username = '', $password = '', |
|
627 | + protected function sendPayloadHTTPS($req, $server, $port, $timeout = 0, $username = '', $password = '', |
|
628 | 628 | $authType = 1, $cert = '', $certPass = '', $caCert = '', $caCertDir = '', $proxyHost = '', $proxyPort = 0, |
629 | 629 | $proxyUsername = '', $proxyPassword = '', $proxyAuthType = 1, $keepAlive = false, $key = '', $keyPass = '', |
630 | 630 | $sslVersion = 0) |
@@ -663,13 +663,13 @@ discard block |
||
663 | 663 | */ |
664 | 664 | protected function sendPayloadSocket($req, $server, $port, $timeout = 0, $username = '', $password = '', |
665 | 665 | $authType = 1, $cert = '', $certPass = '', $caCert = '', $caCertDir = '', $proxyHost = '', $proxyPort = 0, |
666 | - $proxyUsername = '', $proxyPassword = '', $proxyAuthType = 1, $method='http', $key = '', $keyPass = '', |
|
666 | + $proxyUsername = '', $proxyPassword = '', $proxyAuthType = 1, $method = 'http', $key = '', $keyPass = '', |
|
667 | 667 | $sslVersion = 0) |
668 | 668 | { |
669 | 669 | /// @todo log a warning if passed an unsupported method |
670 | 670 | |
671 | 671 | if ($port == 0) { |
672 | - $port = ( $method === 'https' ) ? 443 : 80; |
|
672 | + $port = ($method === 'https') ? 443 : 80; |
|
673 | 673 | } |
674 | 674 | |
675 | 675 | // Only create the payload if it was not created previously |
@@ -699,15 +699,15 @@ discard block |
||
699 | 699 | // thanks to Grant Rauscher <[email protected]> for this |
700 | 700 | $credentials = ''; |
701 | 701 | if ($username != '') { |
702 | - $credentials = 'Authorization: Basic ' . base64_encode($username . ':' . $password) . "\r\n"; |
|
702 | + $credentials = 'Authorization: Basic '.base64_encode($username.':'.$password)."\r\n"; |
|
703 | 703 | if ($authType != 1) { |
704 | - $this->getLogger()->errorLog('XML-RPC: ' . __METHOD__ . ': warning. Only Basic auth is supported with HTTP 1.0'); |
|
704 | + $this->getLogger()->errorLog('XML-RPC: '.__METHOD__.': warning. Only Basic auth is supported with HTTP 1.0'); |
|
705 | 705 | } |
706 | 706 | } |
707 | 707 | |
708 | 708 | $acceptedEncoding = ''; |
709 | 709 | if (is_array($this->accepted_compression) && count($this->accepted_compression)) { |
710 | - $acceptedEncoding = 'Accept-Encoding: ' . implode(', ', $this->accepted_compression) . "\r\n"; |
|
710 | + $acceptedEncoding = 'Accept-Encoding: '.implode(', ', $this->accepted_compression)."\r\n"; |
|
711 | 711 | } |
712 | 712 | |
713 | 713 | $proxyCredentials = ''; |
@@ -718,17 +718,17 @@ discard block |
||
718 | 718 | $connectServer = $proxyHost; |
719 | 719 | $connectPort = $proxyPort; |
720 | 720 | $transport = 'tcp'; |
721 | - $uri = 'http://' . $server . ':' . $port . $this->path; |
|
721 | + $uri = 'http://'.$server.':'.$port.$this->path; |
|
722 | 722 | if ($proxyUsername != '') { |
723 | 723 | if ($proxyAuthType != 1) { |
724 | - $this->getLogger()->errorLog('XML-RPC: ' . __METHOD__ . ': warning. Only Basic auth to proxy is supported with HTTP 1.0'); |
|
724 | + $this->getLogger()->errorLog('XML-RPC: '.__METHOD__.': warning. Only Basic auth to proxy is supported with HTTP 1.0'); |
|
725 | 725 | } |
726 | - $proxyCredentials = 'Proxy-Authorization: Basic ' . base64_encode($proxyUsername . ':' . $proxyPassword) . "\r\n"; |
|
726 | + $proxyCredentials = 'Proxy-Authorization: Basic '.base64_encode($proxyUsername.':'.$proxyPassword)."\r\n"; |
|
727 | 727 | } |
728 | 728 | } else { |
729 | 729 | $connectServer = $server; |
730 | 730 | $connectPort = $port; |
731 | - $transport = ( $method === 'https' ) ? 'tls' : 'tcp'; |
|
731 | + $transport = ($method === 'https') ? 'tls' : 'tcp'; |
|
732 | 732 | $uri = $this->path; |
733 | 733 | } |
734 | 734 | |
@@ -738,45 +738,45 @@ discard block |
||
738 | 738 | $version = ''; |
739 | 739 | foreach ($this->cookies as $name => $cookie) { |
740 | 740 | if ($cookie['version']) { |
741 | - $version = ' $Version="' . $cookie['version'] . '";'; |
|
742 | - $cookieHeader .= ' ' . $name . '="' . $cookie['value'] . '";'; |
|
741 | + $version = ' $Version="'.$cookie['version'].'";'; |
|
742 | + $cookieHeader .= ' '.$name.'="'.$cookie['value'].'";'; |
|
743 | 743 | if ($cookie['path']) { |
744 | - $cookieHeader .= ' $Path="' . $cookie['path'] . '";'; |
|
744 | + $cookieHeader .= ' $Path="'.$cookie['path'].'";'; |
|
745 | 745 | } |
746 | 746 | if ($cookie['domain']) { |
747 | - $cookieHeader .= ' $Domain="' . $cookie['domain'] . '";'; |
|
747 | + $cookieHeader .= ' $Domain="'.$cookie['domain'].'";'; |
|
748 | 748 | } |
749 | 749 | if ($cookie['port']) { |
750 | - $cookieHeader .= ' $Port="' . $cookie['port'] . '";'; |
|
750 | + $cookieHeader .= ' $Port="'.$cookie['port'].'";'; |
|
751 | 751 | } |
752 | 752 | } else { |
753 | - $cookieHeader .= ' ' . $name . '=' . $cookie['value'] . ";"; |
|
753 | + $cookieHeader .= ' '.$name.'='.$cookie['value'].";"; |
|
754 | 754 | } |
755 | 755 | } |
756 | - $cookieHeader = 'Cookie:' . $version . substr($cookieHeader, 0, -1) . "\r\n"; |
|
756 | + $cookieHeader = 'Cookie:'.$version.substr($cookieHeader, 0, -1)."\r\n"; |
|
757 | 757 | } |
758 | 758 | |
759 | 759 | // omit port if default |
760 | 760 | if (($port == 80 && in_array($method, array('http', 'http10'))) || ($port == 443 && $method == 'https')) { |
761 | - $port = ''; |
|
761 | + $port = ''; |
|
762 | 762 | } else { |
763 | - $port = ':' . $port; |
|
763 | + $port = ':'.$port; |
|
764 | 764 | } |
765 | 765 | |
766 | - $op = 'POST ' . $uri . " HTTP/1.0\r\n" . |
|
767 | - 'User-Agent: ' . $this->user_agent . "\r\n" . |
|
768 | - 'Host: ' . $server . $port . "\r\n" . |
|
769 | - $credentials . |
|
770 | - $proxyCredentials . |
|
771 | - $acceptedEncoding . |
|
772 | - $encodingHdr . |
|
773 | - 'Accept-Charset: ' . implode(',', $this->accepted_charset_encodings) . "\r\n" . |
|
774 | - $cookieHeader . |
|
775 | - 'Content-Type: ' . $req->content_type . "\r\nContent-Length: " . |
|
776 | - strlen($payload) . "\r\n\r\n" . |
|
766 | + $op = 'POST '.$uri." HTTP/1.0\r\n". |
|
767 | + 'User-Agent: '.$this->user_agent."\r\n". |
|
768 | + 'Host: '.$server.$port."\r\n". |
|
769 | + $credentials. |
|
770 | + $proxyCredentials. |
|
771 | + $acceptedEncoding. |
|
772 | + $encodingHdr. |
|
773 | + 'Accept-Charset: '.implode(',', $this->accepted_charset_encodings)."\r\n". |
|
774 | + $cookieHeader. |
|
775 | + 'Content-Type: '.$req->content_type."\r\nContent-Length: ". |
|
776 | + strlen($payload)."\r\n\r\n". |
|
777 | 777 | $payload; |
778 | 778 | |
779 | - if ($this->debug > 1) { |
|
779 | + if ($this->debug>1) { |
|
780 | 780 | $this->getLogger()->debugMessage("---SENDING---\n$op\n---END---"); |
781 | 781 | } |
782 | 782 | |
@@ -803,7 +803,7 @@ discard block |
||
803 | 803 | |
804 | 804 | $context = stream_context_create($contextOptions); |
805 | 805 | |
806 | - if ($timeout <= 0) { |
|
806 | + if ($timeout<=0) { |
|
807 | 807 | $connectTimeout = ini_get('default_socket_timeout'); |
808 | 808 | } else { |
809 | 809 | $connectTimeout = $timeout; |
@@ -815,7 +815,7 @@ discard block |
||
815 | 815 | $fp = @stream_socket_client("$transport://$connectServer:$connectPort", $this->errno, $this->errstr, $connectTimeout, |
816 | 816 | STREAM_CLIENT_CONNECT, $context); |
817 | 817 | if ($fp) { |
818 | - if ($timeout > 0) { |
|
818 | + if ($timeout>0) { |
|
819 | 819 | stream_set_timeout($fp, $timeout); |
820 | 820 | } |
821 | 821 | } else { |
@@ -824,8 +824,8 @@ discard block |
||
824 | 824 | $this->errstr = $err['message']; |
825 | 825 | } |
826 | 826 | |
827 | - $this->errstr = 'Connect error: ' . $this->errstr; |
|
828 | - $r = new Response(0, PhpXmlRpc::$xmlrpcerr['http_error'], $this->errstr . ' (' . $this->errno . ')'); |
|
827 | + $this->errstr = 'Connect error: '.$this->errstr; |
|
828 | + $r = new Response(0, PhpXmlRpc::$xmlrpcerr['http_error'], $this->errstr.' ('.$this->errno.')'); |
|
829 | 829 | |
830 | 830 | return $r; |
831 | 831 | } |
@@ -914,13 +914,13 @@ discard block |
||
914 | 914 | |
915 | 915 | $result = curl_exec($curl); |
916 | 916 | |
917 | - if ($this->debug > 1) { |
|
917 | + if ($this->debug>1) { |
|
918 | 918 | $message = "---CURL INFO---\n"; |
919 | 919 | foreach (curl_getinfo($curl) as $name => $val) { |
920 | 920 | if (is_array($val)) { |
921 | 921 | $val = implode("\n", $val); |
922 | 922 | } |
923 | - $message .= $name . ': ' . $val . "\n"; |
|
923 | + $message .= $name.': '.$val."\n"; |
|
924 | 924 | } |
925 | 925 | $message .= '---END---'; |
926 | 926 | $this->getLogger()->debugMessage($message); |
@@ -930,7 +930,7 @@ discard block |
||
930 | 930 | /// @todo we should use a better check here - what if we get back '' or '0'? |
931 | 931 | |
932 | 932 | $this->errstr = 'no response'; |
933 | - $resp = new Response(0, PhpXmlRpc::$xmlrpcerr['curl_fail'], PhpXmlRpc::$xmlrpcstr['curl_fail'] . ': ' . curl_error($curl)); |
|
933 | + $resp = new Response(0, PhpXmlRpc::$xmlrpcerr['curl_fail'], PhpXmlRpc::$xmlrpcstr['curl_fail'].': '.curl_error($curl)); |
|
934 | 934 | curl_close($curl); |
935 | 935 | if ($keepAlive) { |
936 | 936 | $this->xmlrpc_curl_handle = null; |
@@ -999,7 +999,7 @@ discard block |
||
999 | 999 | $protocol = $method; |
1000 | 1000 | } |
1001 | 1001 | } |
1002 | - $curl = curl_init($protocol . '://' . $server . ':' . $port . $this->path); |
|
1002 | + $curl = curl_init($protocol.'://'.$server.':'.$port.$this->path); |
|
1003 | 1003 | if ($keepAlive) { |
1004 | 1004 | $this->xmlrpc_curl_handle = $curl; |
1005 | 1005 | } |
@@ -1010,7 +1010,7 @@ discard block |
||
1010 | 1010 | // results into variable |
1011 | 1011 | curl_setopt($curl, CURLOPT_RETURNTRANSFER, true); |
1012 | 1012 | |
1013 | - if ($this->debug > 1) { |
|
1013 | + if ($this->debug>1) { |
|
1014 | 1014 | curl_setopt($curl, CURLOPT_VERBOSE, true); |
1015 | 1015 | /// @todo allow callers to redirect curlopt_stderr to some stream which can be buffered |
1016 | 1016 | } |
@@ -1035,7 +1035,7 @@ discard block |
||
1035 | 1035 | } |
1036 | 1036 | } |
1037 | 1037 | // extra headers |
1038 | - $headers = array('Content-Type: ' . $req->content_type, 'Accept-Charset: ' . implode(',', $this->accepted_charset_encodings)); |
|
1038 | + $headers = array('Content-Type: '.$req->content_type, 'Accept-Charset: '.implode(',', $this->accepted_charset_encodings)); |
|
1039 | 1039 | // if no keepalive is wanted, let the server know it in advance |
1040 | 1040 | if (!$keepAlive) { |
1041 | 1041 | $headers[] = 'Connection: close'; |
@@ -1052,10 +1052,10 @@ discard block |
||
1052 | 1052 | curl_setopt($curl, CURLOPT_HTTPHEADER, $headers); |
1053 | 1053 | // timeout is borked |
1054 | 1054 | if ($timeout) { |
1055 | - curl_setopt($curl, CURLOPT_TIMEOUT, $timeout == 1 ? 1 : $timeout - 1); |
|
1055 | + curl_setopt($curl, CURLOPT_TIMEOUT, $timeout == 1 ? 1 : $timeout-1); |
|
1056 | 1056 | } |
1057 | 1057 | |
1058 | - switch($method) { |
|
1058 | + switch ($method) { |
|
1059 | 1059 | case 'http10': |
1060 | 1060 | curl_setopt($curl, CURLOPT_HTTP_VERSION, CURL_HTTP_VERSION_1_0); |
1061 | 1061 | break; |
@@ -1071,11 +1071,11 @@ discard block |
||
1071 | 1071 | } |
1072 | 1072 | |
1073 | 1073 | if ($username && $password) { |
1074 | - curl_setopt($curl, CURLOPT_USERPWD, $username . ':' . $password); |
|
1074 | + curl_setopt($curl, CURLOPT_USERPWD, $username.':'.$password); |
|
1075 | 1075 | if (defined('CURLOPT_HTTPAUTH')) { |
1076 | 1076 | curl_setopt($curl, CURLOPT_HTTPAUTH, $authType); |
1077 | 1077 | } elseif ($authType != 1) { |
1078 | - $this->getLogger()->errorLog('XML-RPC: ' . __METHOD__ . ': warning. Only Basic auth is supported by the current PHP/curl install'); |
|
1078 | + $this->getLogger()->errorLog('XML-RPC: '.__METHOD__.': warning. Only Basic auth is supported by the current PHP/curl install'); |
|
1079 | 1079 | } |
1080 | 1080 | } |
1081 | 1081 | |
@@ -1117,13 +1117,13 @@ discard block |
||
1117 | 1117 | if ($proxyPort == 0) { |
1118 | 1118 | $proxyPort = 8080; // NB: even for HTTPS, local connection is on port 8080 |
1119 | 1119 | } |
1120 | - curl_setopt($curl, CURLOPT_PROXY, $proxyHost . ':' . $proxyPort); |
|
1120 | + curl_setopt($curl, CURLOPT_PROXY, $proxyHost.':'.$proxyPort); |
|
1121 | 1121 | if ($proxyUsername) { |
1122 | - curl_setopt($curl, CURLOPT_PROXYUSERPWD, $proxyUsername . ':' . $proxyPassword); |
|
1122 | + curl_setopt($curl, CURLOPT_PROXYUSERPWD, $proxyUsername.':'.$proxyPassword); |
|
1123 | 1123 | if (defined('CURLOPT_PROXYAUTH')) { |
1124 | 1124 | curl_setopt($curl, CURLOPT_PROXYAUTH, $proxyAuthType); |
1125 | 1125 | } elseif ($proxyAuthType != 1) { |
1126 | - $this->getLogger()->errorLog('XML-RPC: ' . __METHOD__ . ': warning. Only Basic auth to proxy is supported by the current PHP/curl install'); |
|
1126 | + $this->getLogger()->errorLog('XML-RPC: '.__METHOD__.': warning. Only Basic auth to proxy is supported by the current PHP/curl install'); |
|
1127 | 1127 | } |
1128 | 1128 | } |
1129 | 1129 | } |
@@ -1133,7 +1133,7 @@ discard block |
||
1133 | 1133 | if (count($this->cookies)) { |
1134 | 1134 | $cookieHeader = ''; |
1135 | 1135 | foreach ($this->cookies as $name => $cookie) { |
1136 | - $cookieHeader .= $name . '=' . $cookie['value'] . '; '; |
|
1136 | + $cookieHeader .= $name.'='.$cookie['value'].'; '; |
|
1137 | 1137 | } |
1138 | 1138 | curl_setopt($curl, CURLOPT_COOKIE, substr($cookieHeader, 0, -2)); |
1139 | 1139 | } |
@@ -1142,7 +1142,7 @@ discard block |
||
1142 | 1142 | curl_setopt($curl, $opt, $val); |
1143 | 1143 | } |
1144 | 1144 | |
1145 | - if ($this->debug > 1) { |
|
1145 | + if ($this->debug>1) { |
|
1146 | 1146 | $this->getLogger()->debugMessage("---SENDING---\n$payload\n---END---"); |
1147 | 1147 | } |
1148 | 1148 | |
@@ -1240,7 +1240,7 @@ discard block |
||
1240 | 1240 | $call['methodName'] = new Value($req->method(), 'string'); |
1241 | 1241 | $numParams = $req->getNumParams(); |
1242 | 1242 | $params = array(); |
1243 | - for ($i = 0; $i < $numParams; $i++) { |
|
1243 | + for ($i = 0; $i<$numParams; $i++) { |
|
1244 | 1244 | $params[$i] = $req->getParam($i); |
1245 | 1245 | } |
1246 | 1246 | $call['params'] = new Value($params, 'array'); |
@@ -1266,15 +1266,15 @@ discard block |
||
1266 | 1266 | /// @todo test this code branch... |
1267 | 1267 | $rets = $result->value(); |
1268 | 1268 | if (!is_array($rets)) { |
1269 | - return false; // bad return type from system.multicall |
|
1269 | + return false; // bad return type from system.multicall |
|
1270 | 1270 | } |
1271 | 1271 | $numRets = count($rets); |
1272 | 1272 | if ($numRets != count($reqs)) { |
1273 | - return false; // wrong number of return values. |
|
1273 | + return false; // wrong number of return values. |
|
1274 | 1274 | } |
1275 | 1275 | |
1276 | 1276 | $response = array(); |
1277 | - for ($i = 0; $i < $numRets; $i++) { |
|
1277 | + for ($i = 0; $i<$numRets; $i++) { |
|
1278 | 1278 | $val = $rets[$i]; |
1279 | 1279 | if (!is_array($val)) { |
1280 | 1280 | return false; |
@@ -1282,7 +1282,7 @@ discard block |
||
1282 | 1282 | switch (count($val)) { |
1283 | 1283 | case 1: |
1284 | 1284 | if (!isset($val[0])) { |
1285 | - return false; // Bad value |
|
1285 | + return false; // Bad value |
|
1286 | 1286 | } |
1287 | 1287 | // Normal return value |
1288 | 1288 | $response[$i] = new Response($val[0], 0, '', 'phpvals'); |
@@ -1310,19 +1310,19 @@ discard block |
||
1310 | 1310 | |
1311 | 1311 | $rets = $result->value(); |
1312 | 1312 | if ($rets->kindOf() != 'array') { |
1313 | - return false; // bad return type from system.multicall |
|
1313 | + return false; // bad return type from system.multicall |
|
1314 | 1314 | } |
1315 | 1315 | $numRets = $rets->count(); |
1316 | 1316 | if ($numRets != count($reqs)) { |
1317 | - return false; // wrong number of return values. |
|
1317 | + return false; // wrong number of return values. |
|
1318 | 1318 | } |
1319 | 1319 | |
1320 | 1320 | $response = array(); |
1321 | - foreach($rets as $val) { |
|
1321 | + foreach ($rets as $val) { |
|
1322 | 1322 | switch ($val->kindOf()) { |
1323 | 1323 | case 'array': |
1324 | 1324 | if ($val->count() != 1) { |
1325 | - return false; // Bad value |
|
1325 | + return false; // Bad value |
|
1326 | 1326 | } |
1327 | 1327 | // Normal return value |
1328 | 1328 | $response[] = new Response($val[0]); |
@@ -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>xmlrpc</title></head> |
@@ -11,9 +11,9 @@ discard block |
||
11 | 11 | output("<h3>Testing value serialization</h3>\n"); |
12 | 12 | |
13 | 13 | $v = new PhpXmlRpc\Value(23, "int"); |
14 | -output("<PRE>" . htmlentities($v->serialize()) . "</PRE>"); |
|
14 | +output("<PRE>".htmlentities($v->serialize())."</PRE>"); |
|
15 | 15 | $v = new PhpXmlRpc\Value("What are you saying? >> << &&"); |
16 | -output("<PRE>" . htmlentities($v->serialize()) . "</PRE>"); |
|
16 | +output("<PRE>".htmlentities($v->serialize())."</PRE>"); |
|
17 | 17 | |
18 | 18 | $v = new PhpXmlRpc\Value( |
19 | 19 | array( |
@@ -24,7 +24,7 @@ discard block |
||
24 | 24 | "array" |
25 | 25 | ); |
26 | 26 | |
27 | -output("<PRE>" . htmlentities($v->serialize()) . "</PRE>"); |
|
27 | +output("<PRE>".htmlentities($v->serialize())."</PRE>"); |
|
28 | 28 | |
29 | 29 | $v = new PhpXmlRpc\Value( |
30 | 30 | array( |
@@ -52,11 +52,11 @@ discard block |
||
52 | 52 | "struct" |
53 | 53 | ); |
54 | 54 | |
55 | -output("<PRE>" . htmlentities($v->serialize()) . "</PRE>"); |
|
55 | +output("<PRE>".htmlentities($v->serialize())."</PRE>"); |
|
56 | 56 | |
57 | 57 | $w = new PhpXmlRpc\Value(array($v, new PhpXmlRpc\Value("That was the struct!")), "array"); |
58 | 58 | |
59 | -output("<PRE>" . htmlentities($w->serialize()) . "</PRE>"); |
|
59 | +output("<PRE>".htmlentities($w->serialize())."</PRE>"); |
|
60 | 60 | |
61 | 61 | $w = new PhpXmlRpc\Value("Mary had a little lamb, |
62 | 62 | Whose fleece was white as snow, |
@@ -68,29 +68,29 @@ discard block |
||
68 | 68 | Ten thousand volts went down its back |
69 | 69 | And turned it into nylon", "base64" |
70 | 70 | ); |
71 | -output("<PRE>" . htmlentities($w->serialize()) . "</PRE>"); |
|
72 | -output("<PRE>Value of base64 string is: '" . $w->scalarval() . "'</PRE>"); |
|
71 | +output("<PRE>".htmlentities($w->serialize())."</PRE>"); |
|
72 | +output("<PRE>Value of base64 string is: '".$w->scalarval()."'</PRE>"); |
|
73 | 73 | |
74 | 74 | $req->method(''); |
75 | 75 | $req->addParam(new PhpXmlRpc\Value("41", "int")); |
76 | 76 | |
77 | 77 | output("<h3>Testing request serialization</h3>\n"); |
78 | 78 | $op = $req->serialize(); |
79 | -output("<PRE>" . htmlentities($op) . "</PRE>"); |
|
79 | +output("<PRE>".htmlentities($op)."</PRE>"); |
|
80 | 80 | |
81 | 81 | output("<h3>Testing ISO date format</h3><pre>\n"); |
82 | 82 | |
83 | 83 | $t = time(); |
84 | 84 | $date = PhpXmlRpc\Helper\Date::iso8601Encode($t); |
85 | 85 | output("Now is $t --> $date\n"); |
86 | -output("Or in UTC, that is " . PhpXmlRpc\Helper\Date::iso8601Encode($t, 1) . "\n"); |
|
86 | +output("Or in UTC, that is ".PhpXmlRpc\Helper\Date::iso8601Encode($t, 1)."\n"); |
|
87 | 87 | $tb = PhpXmlRpc\Helper\Date::iso8601Decode($date); |
88 | 88 | output("That is to say $date --> $tb\n"); |
89 | -output("Which comes out at " . PhpXmlRpc\Helper\Date::iso8601Encode($tb) . "\n"); |
|
90 | -output("Which was the time in UTC at " . PhpXmlRpc\Helper\Date::iso8601Encode($tb, 1) . "\n"); |
|
89 | +output("Which comes out at ".PhpXmlRpc\Helper\Date::iso8601Encode($tb)."\n"); |
|
90 | +output("Which was the time in UTC at ".PhpXmlRpc\Helper\Date::iso8601Encode($tb, 1)."\n"); |
|
91 | 91 | |
92 | 92 | output("</pre>\n"); |
93 | 93 | |
94 | 94 | output('</body></html>'); |
95 | 95 | |
96 | -require_once __DIR__ . "/client/_append.php"; |
|
96 | +require_once __DIR__."/client/_append.php"; |
@@ -10,7 +10,7 @@ discard block |
||
10 | 10 | * @license code licensed under the BSD License: see file license.txt |
11 | 11 | */ |
12 | 12 | |
13 | -require_once __DIR__ . "/_prepend.php"; |
|
13 | +require_once __DIR__."/_prepend.php"; |
|
14 | 14 | |
15 | 15 | /** |
16 | 16 | * Forward an xmlrpc request to another server, and return to client the response received. |
@@ -31,7 +31,7 @@ discard block |
||
31 | 31 | // NB: here we should validate the received url, using f.e. a whitelist... |
32 | 32 | $client = new PhpXmlRpc\Client($url); |
33 | 33 | |
34 | - if ($req->getNumParams() > 3) { |
|
34 | + if ($req->getNumParams()>3) { |
|
35 | 35 | // we have to set some options onto the client. |
36 | 36 | // Note that if we do not untaint the received values, warnings might be generated... |
37 | 37 | $options = $encoder->decode($req->getParam(3)); |
@@ -51,7 +51,7 @@ discard block |
||
51 | 51 | $client->setSSLVerifyPeer($val); |
52 | 52 | break; |
53 | 53 | case 'Timeout': |
54 | - $timeout = (integer)$val; |
|
54 | + $timeout = (integer) $val; |
|
55 | 55 | break; |
56 | 56 | } // switch |
57 | 57 | } |
@@ -69,7 +69,7 @@ discard block |
||
69 | 69 | } |
70 | 70 | |
71 | 71 | // add debug info into response we give back to caller |
72 | - PhpXmlRpc\Server::xmlrpc_debugmsg("Sending to server $url the payload: " . $req->serialize()); |
|
72 | + PhpXmlRpc\Server::xmlrpc_debugmsg("Sending to server $url the payload: ".$req->serialize()); |
|
73 | 73 | |
74 | 74 | return $client->send($req, $timeout); |
75 | 75 | } |
@@ -90,4 +90,4 @@ discard block |
||
90 | 90 | ) |
91 | 91 | ); |
92 | 92 | |
93 | -require_once __DIR__ . "/_append.php"; |
|
93 | +require_once __DIR__."/_append.php"; |
@@ -4,7 +4,7 @@ discard block |
||
4 | 4 | * It uses a Berkeley DB database for storage. |
5 | 5 | */ |
6 | 6 | |
7 | -require_once __DIR__ . "/_prepend.php"; |
|
7 | +require_once __DIR__."/_prepend.php"; |
|
8 | 8 | |
9 | 9 | use PhpXmlRpc\Value; |
10 | 10 | |
@@ -35,8 +35,8 @@ discard block |
||
35 | 35 | $count = 0; |
36 | 36 | } |
37 | 37 | // add the new comment in |
38 | - dba_insert($msgID . "_comment_${count}", $comment, $dbh); |
|
39 | - dba_insert($msgID . "_name_${count}", $name, $dbh); |
|
38 | + dba_insert($msgID."_comment_${count}", $comment, $dbh); |
|
39 | + dba_insert($msgID."_name_${count}", $name, $dbh); |
|
40 | 40 | $count++; |
41 | 41 | dba_replace($countID, $count, $dbh); |
42 | 42 | dba_close($dbh); |
@@ -69,7 +69,7 @@ discard block |
||
69 | 69 | $countID = "${msgID}_count"; |
70 | 70 | if (dba_exists($countID, $dbh)) { |
71 | 71 | $count = dba_fetch($countID, $dbh); |
72 | - for ($i = 0; $i < $count; $i++) { |
|
72 | + for ($i = 0; $i<$count; $i++) { |
|
73 | 73 | $name = dba_fetch("${msgID}_name_${i}", $dbh); |
74 | 74 | $comment = dba_fetch("${msgID}_comment_${i}", $dbh); |
75 | 75 | // push a new struct onto the return array |
@@ -107,4 +107,4 @@ discard block |
||
107 | 107 | ), |
108 | 108 | )); |
109 | 109 | |
110 | -require_once __DIR__ . "/_append.php"; |
|
110 | +require_once __DIR__."/_append.php"; |
@@ -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>xmlrpc - Getstatename demo</title></head> |
@@ -11,34 +11,34 @@ discard block |
||
11 | 11 | '); |
12 | 12 | |
13 | 13 | if (isset($_POST["stateno"]) && $_POST["stateno"] != "") { |
14 | - $stateNo = (integer)$_POST["stateno"]; |
|
14 | + $stateNo = (integer) $_POST["stateno"]; |
|
15 | 15 | $encoder = new PhpXmlRpc\Encoder(); |
16 | 16 | $req = new PhpXmlRpc\Request('examples.getStateName', |
17 | 17 | array($encoder->encode($stateNo)) |
18 | 18 | ); |
19 | - output("Sending the following request:<pre>\n\n" . htmlentities($req->serialize()) . "\n\n</pre>Debug info of server data follows...\n\n"); |
|
19 | + output("Sending the following request:<pre>\n\n".htmlentities($req->serialize())."\n\n</pre>Debug info of server data follows...\n\n"); |
|
20 | 20 | $client = new PhpXmlRpc\Client(XMLRPCSERVER); |
21 | 21 | $client->setDebug(1); |
22 | 22 | $r = $client->send($req); |
23 | 23 | if (!$r->faultCode()) { |
24 | 24 | $v = $r->value(); |
25 | - output("<br/>State number <b>" . $stateNo . "</b> is <b>" |
|
26 | - . htmlspecialchars($encoder->decode($v)) . "</b><br/><br/>"); |
|
25 | + output("<br/>State number <b>".$stateNo."</b> is <b>" |
|
26 | + . htmlspecialchars($encoder->decode($v))."</b><br/><br/>"); |
|
27 | 27 | } else { |
28 | 28 | output("An error occurred: "); |
29 | - output("Code: " . htmlspecialchars($r->faultCode()) |
|
30 | - . " Reason: '" . htmlspecialchars($r->faultString()) . "'</pre><br/>"); |
|
29 | + output("Code: ".htmlspecialchars($r->faultCode()) |
|
30 | + . " Reason: '".htmlspecialchars($r->faultString())."'</pre><br/>"); |
|
31 | 31 | } |
32 | 32 | } else { |
33 | 33 | $stateNo = ""; |
34 | 34 | } |
35 | 35 | |
36 | 36 | output("<form action=\"getstatename.php\" method=\"POST\"> |
37 | -<input name=\"stateno\" value=\"" . $stateNo . "\"> |
|
37 | +<input name=\"stateno\" value=\"" . $stateNo."\"> |
|
38 | 38 | <input type=\"submit\" value=\"go\" name=\"submit\"> |
39 | 39 | </form> |
40 | 40 | <p>Enter a state number to query its name</p>"); |
41 | 41 | |
42 | 42 | output("</body></html>\n"); |
43 | 43 | |
44 | -require_once __DIR__ . "/_append.php"; |
|
44 | +require_once __DIR__."/_append.php"; |
@@ -3,5 +3,5 @@ |
||
3 | 3 | // Out-of-band information: let the client manipulate the page operations. |
4 | 4 | // We do this to help the testsuite script: do not reproduce in production! |
5 | 5 | if (isset($_COOKIE['PHPUNIT_SELENIUM_TEST_ID']) && extension_loaded('xdebug')) { |
6 | - include_once __DIR__ . "/../../vendor/phpunit/phpunit-selenium/PHPUnit/Extensions/SeleniumCommon/append.php"; |
|
6 | + include_once __DIR__."/../../vendor/phpunit/phpunit-selenium/PHPUnit/Extensions/SeleniumCommon/append.php"; |
|
7 | 7 | } |
@@ -1,6 +1,6 @@ discard block |
||
1 | 1 | <?php |
2 | 2 | |
3 | -require_once __DIR__ . "/_prepend.php"; |
|
3 | +require_once __DIR__."/_prepend.php"; |
|
4 | 4 | |
5 | 5 | use PhpXmlRpc\Encoder; |
6 | 6 | use PhpXmlRpc\Client; |
@@ -25,7 +25,7 @@ discard block |
||
25 | 25 | $handles = array(); |
26 | 26 | $curl = curl_multi_init(); |
27 | 27 | |
28 | - foreach($requests as $k => $req) { |
|
28 | + foreach ($requests as $k => $req) { |
|
29 | 29 | $req->setDebug($this->debug); |
30 | 30 | |
31 | 31 | $handle = $this->prepareCurlHandle( |
@@ -58,19 +58,19 @@ discard block |
||
58 | 58 | $running = 0; |
59 | 59 | do { |
60 | 60 | curl_multi_exec($curl, $running); |
61 | - } while($running > 0); |
|
61 | + } while ($running>0); |
|
62 | 62 | |
63 | 63 | $responses = array(); |
64 | - foreach($handles as $k => $h) { |
|
64 | + foreach ($handles as $k => $h) { |
|
65 | 65 | $responses[$k] = curl_multi_getcontent($handles[$k]); |
66 | 66 | |
67 | - if ($this->debug > 1) { |
|
67 | + if ($this->debug>1) { |
|
68 | 68 | $message = "---CURL INFO---\n"; |
69 | 69 | foreach (curl_getinfo($h) as $name => $val) { |
70 | 70 | if (is_array($val)) { |
71 | 71 | $val = implode("\n", $val); |
72 | 72 | } |
73 | - $message .= $name . ': ' . $val . "\n"; |
|
73 | + $message .= $name.': '.$val."\n"; |
|
74 | 74 | } |
75 | 75 | $message .= '---END---'; |
76 | 76 | $this->getLogger()->debugMessage($message); |
@@ -81,9 +81,9 @@ discard block |
||
81 | 81 | } |
82 | 82 | curl_multi_close($curl); |
83 | 83 | |
84 | - foreach($responses as $k => $resp) { |
|
84 | + foreach ($responses as $k => $resp) { |
|
85 | 85 | if (!$resp) { |
86 | - $responses[$k] = new Response(0, PhpXmlRpc::$xmlrpcerr['curl_fail'], PhpXmlRpc::$xmlrpcstr['curl_fail'] . ': ' . curl_error($curl)); |
|
86 | + $responses[$k] = new Response(0, PhpXmlRpc::$xmlrpcerr['curl_fail'], PhpXmlRpc::$xmlrpcstr['curl_fail'].': '.curl_error($curl)); |
|
87 | 87 | } else { |
88 | 88 | $responses[$k] = $requests[$k]->parseResponse($resp, true, $this->return_type); |
89 | 89 | } |
@@ -100,7 +100,7 @@ discard block |
||
100 | 100 | $value = $encoder->encode($data, array('auto_dates')); |
101 | 101 | $req = new Request('interopEchoTests.echoValue', array($value)); |
102 | 102 | $reqs = array(); |
103 | -for ($i = 0; $i < $num_tests; $i++) { |
|
103 | +for ($i = 0; $i<$num_tests; $i++) { |
|
104 | 104 | $reqs[] = $req; |
105 | 105 | } |
106 | 106 | |
@@ -109,18 +109,18 @@ discard block |
||
109 | 109 | |
110 | 110 | $t = microtime(true); |
111 | 111 | $resp = $client->send($reqs); |
112 | -$t = microtime(true) - $t; |
|
112 | +$t = microtime(true)-$t; |
|
113 | 113 | echo "Sequential send: $t secs\n"; |
114 | 114 | |
115 | 115 | $t = microtime(true); |
116 | 116 | $resp = $client->sendParallel($reqs); |
117 | -$t = microtime(true) - $t; |
|
117 | +$t = microtime(true)-$t; |
|
118 | 118 | echo "Parallel send: $t secs\n"; |
119 | 119 | |
120 | 120 | $client->no_multicall = false; |
121 | 121 | $t = microtime(true); |
122 | 122 | $resp = $client->send($reqs); |
123 | -$t = microtime(true) - $t; |
|
123 | +$t = microtime(true)-$t; |
|
124 | 124 | echo "Multicall send: $t secs\n"; |
125 | 125 | |
126 | -require_once __DIR__ . "/_append.php"; |
|
126 | +require_once __DIR__."/_append.php"; |
@@ -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>xmlrpc - Agesort demo</title></head> |
@@ -13,7 +13,7 @@ discard block |
||
13 | 13 | $inAr = array("Dave" => 24, "Edd" => 45, "Joe" => 37, "Fred" => 27); |
14 | 14 | output("This is the input data:<br/><pre>"); |
15 | 15 | foreach ($inAr as $key => $val) { |
16 | - output($key . ", " . $val . "\n"); |
|
16 | + output($key.", ".$val."\n"); |
|
17 | 17 | } |
18 | 18 | output("</pre>"); |
19 | 19 | |
@@ -29,7 +29,7 @@ discard block |
||
29 | 29 | ); |
30 | 30 | } |
31 | 31 | $v = new PhpXmlRpc\Value($p, "array"); |
32 | -output("Encoded into xmlrpc format it looks like this: <pre>\n" . htmlentities($v->serialize()) . "</pre>\n"); |
|
32 | +output("Encoded into xmlrpc format it looks like this: <pre>\n".htmlentities($v->serialize())."</pre>\n"); |
|
33 | 33 | |
34 | 34 | // create client and message objects |
35 | 35 | $req = new PhpXmlRpc\Request('examples.sortByAge', array($v)); |
@@ -49,17 +49,17 @@ discard block |
||
49 | 49 | foreach ($value as $struct) { |
50 | 50 | $name = $struct["name"]; |
51 | 51 | $age = $struct["age"]; |
52 | - output(htmlspecialchars($name->scalarval()) . ", " . htmlspecialchars($age->scalarval()) . "\n"); |
|
52 | + output(htmlspecialchars($name->scalarval()).", ".htmlspecialchars($age->scalarval())."\n"); |
|
53 | 53 | } |
54 | 54 | |
55 | - output("<hr/>For nerds: I got this value back<br/><pre>" . |
|
56 | - htmlentities($resp->serialize()) . "</pre><hr/>\n"); |
|
55 | + output("<hr/>For nerds: I got this value back<br/><pre>". |
|
56 | + htmlentities($resp->serialize())."</pre><hr/>\n"); |
|
57 | 57 | } else { |
58 | 58 | output("An error occurred:<pre>"); |
59 | - output("Code: " . htmlspecialchars($resp->faultCode()) . |
|
60 | - "\nReason: '" . htmlspecialchars($resp->faultString()) . '\'</pre><hr/>'); |
|
59 | + output("Code: ".htmlspecialchars($resp->faultCode()). |
|
60 | + "\nReason: '".htmlspecialchars($resp->faultString()).'\'</pre><hr/>'); |
|
61 | 61 | } |
62 | 62 | |
63 | 63 | output("</body></html>\n"); |
64 | 64 | |
65 | -require_once __DIR__ . "/_append.php"; |
|
65 | +require_once __DIR__."/_append.php"; |