@@ -184,10 +184,10 @@ discard block |
||
184 | 184 | $server = $parts['host']; |
185 | 185 | $path = isset($parts['path']) ? $parts['path'] : ''; |
186 | 186 | if (isset($parts['query'])) { |
187 | - $path .= '?' . $parts['query']; |
|
187 | + $path .= '?'.$parts['query']; |
|
188 | 188 | } |
189 | 189 | if (isset($parts['fragment'])) { |
190 | - $path .= '#' . $parts['fragment']; |
|
190 | + $path .= '#'.$parts['fragment']; |
|
191 | 191 | } |
192 | 192 | if (isset($parts['port'])) { |
193 | 193 | $port = $parts['port']; |
@@ -203,7 +203,7 @@ discard block |
||
203 | 203 | } |
204 | 204 | } |
205 | 205 | if ($path == '' || $path[0] != '/') { |
206 | - $this->path = '/' . $path; |
|
206 | + $this->path = '/'.$path; |
|
207 | 207 | } else { |
208 | 208 | $this->path = $path; |
209 | 209 | } |
@@ -241,7 +241,7 @@ discard block |
||
241 | 241 | }*/ |
242 | 242 | |
243 | 243 | // initialize user_agent string |
244 | - $this->user_agent = PhpXmlRpc::$xmlrpcName . ' ' . PhpXmlRpc::$xmlrpcVersion; |
|
244 | + $this->user_agent = PhpXmlRpc::$xmlrpcName.' '.PhpXmlRpc::$xmlrpcVersion; |
|
245 | 245 | } |
246 | 246 | |
247 | 247 | /** |
@@ -633,7 +633,7 @@ discard block |
||
633 | 633 | */ |
634 | 634 | protected function sendPayloadHTTP10($req, $server, $port, $timeout = 0, $username = '', $password = '', |
635 | 635 | $authType = 1, $proxyHost = '', $proxyPort = 0, $proxyUsername = '', $proxyPassword = '', $proxyAuthType = 1, |
636 | - $method='http') |
|
636 | + $method = 'http') |
|
637 | 637 | { |
638 | 638 | //trigger_error('Method ' . __METHOD__ . ' is deprecated', E_USER_DEPRECATED); |
639 | 639 | |
@@ -665,7 +665,7 @@ discard block |
||
665 | 665 | * @param int $sslVersion |
666 | 666 | * @return Response |
667 | 667 | */ |
668 | - protected function sendPayloadHTTPS($req, $server, $port, $timeout = 0, $username = '', $password = '', |
|
668 | + protected function sendPayloadHTTPS($req, $server, $port, $timeout = 0, $username = '', $password = '', |
|
669 | 669 | $authType = 1, $cert = '', $certPass = '', $caCert = '', $caCertDir = '', $proxyHost = '', $proxyPort = 0, |
670 | 670 | $proxyUsername = '', $proxyPassword = '', $proxyAuthType = 1, $keepAlive = false, $key = '', $keyPass = '', |
671 | 671 | $sslVersion = 0) |
@@ -704,7 +704,7 @@ discard block |
||
704 | 704 | */ |
705 | 705 | protected function sendPayloadSocket($req, $server, $port, $timeout = 0, $username = '', $password = '', |
706 | 706 | $authType = 1, $cert = '', $certPass = '', $caCert = '', $caCertDir = '', $proxyHost = '', $proxyPort = 0, |
707 | - $proxyUsername = '', $proxyPassword = '', $proxyAuthType = 1, $method='http', $key = '', $keyPass = '', |
|
707 | + $proxyUsername = '', $proxyPassword = '', $proxyAuthType = 1, $method = 'http', $key = '', $keyPass = '', |
|
708 | 708 | $sslVersion = 0) |
709 | 709 | { |
710 | 710 | /// @todo log a warning if passed an unsupported method |
@@ -740,16 +740,16 @@ discard block |
||
740 | 740 | // thanks to Grant Rauscher <[email protected]> for this |
741 | 741 | $credentials = ''; |
742 | 742 | if ($username != '') { |
743 | - $credentials = 'Authorization: Basic ' . base64_encode($username . ':' . $password) . "\r\n"; |
|
743 | + $credentials = 'Authorization: Basic '.base64_encode($username.':'.$password)."\r\n"; |
|
744 | 744 | if ($authType != 1) { |
745 | 745 | /// @todo make this a proper error, ie. return a failure |
746 | - $this->getLogger()->errorLog('XML-RPC: ' . __METHOD__ . ': warning. Only Basic auth is supported with HTTP 1.0'); |
|
746 | + $this->getLogger()->errorLog('XML-RPC: '.__METHOD__.': warning. Only Basic auth is supported with HTTP 1.0'); |
|
747 | 747 | } |
748 | 748 | } |
749 | 749 | |
750 | 750 | $acceptedEncoding = ''; |
751 | 751 | if (is_array($this->accepted_compression) && count($this->accepted_compression)) { |
752 | - $acceptedEncoding = 'Accept-Encoding: ' . implode(', ', $this->accepted_compression) . "\r\n"; |
|
752 | + $acceptedEncoding = 'Accept-Encoding: '.implode(', ', $this->accepted_compression)."\r\n"; |
|
753 | 753 | } |
754 | 754 | |
755 | 755 | $proxyCredentials = ''; |
@@ -761,13 +761,13 @@ discard block |
||
761 | 761 | $connectPort = $proxyPort; |
762 | 762 | $transport = 'tcp'; |
763 | 763 | /// @todo check: should we not use https in some cases? |
764 | - $uri = 'http://' . $server . ':' . $port . $this->path; |
|
764 | + $uri = 'http://'.$server.':'.$port.$this->path; |
|
765 | 765 | if ($proxyUsername != '') { |
766 | 766 | if ($proxyAuthType != 1) { |
767 | 767 | /// @todo make this a proper error, ie. return a failure |
768 | - $this->getLogger()->errorLog('XML-RPC: ' . __METHOD__ . ': warning. Only Basic auth to proxy is supported with HTTP 1.0'); |
|
768 | + $this->getLogger()->errorLog('XML-RPC: '.__METHOD__.': warning. Only Basic auth to proxy is supported with HTTP 1.0'); |
|
769 | 769 | } |
770 | - $proxyCredentials = 'Proxy-Authorization: Basic ' . base64_encode($proxyUsername . ':' . $proxyPassword) . "\r\n"; |
|
770 | + $proxyCredentials = 'Proxy-Authorization: Basic '.base64_encode($proxyUsername.':'.$proxyPassword)."\r\n"; |
|
771 | 771 | } |
772 | 772 | } else { |
773 | 773 | $connectServer = $server; |
@@ -782,45 +782,45 @@ discard block |
||
782 | 782 | $version = ''; |
783 | 783 | foreach ($this->cookies as $name => $cookie) { |
784 | 784 | if ($cookie['version']) { |
785 | - $version = ' $Version="' . $cookie['version'] . '";'; |
|
786 | - $cookieHeader .= ' ' . $name . '="' . $cookie['value'] . '";'; |
|
785 | + $version = ' $Version="'.$cookie['version'].'";'; |
|
786 | + $cookieHeader .= ' '.$name.'="'.$cookie['value'].'";'; |
|
787 | 787 | if ($cookie['path']) { |
788 | - $cookieHeader .= ' $Path="' . $cookie['path'] . '";'; |
|
788 | + $cookieHeader .= ' $Path="'.$cookie['path'].'";'; |
|
789 | 789 | } |
790 | 790 | if ($cookie['domain']) { |
791 | - $cookieHeader .= ' $Domain="' . $cookie['domain'] . '";'; |
|
791 | + $cookieHeader .= ' $Domain="'.$cookie['domain'].'";'; |
|
792 | 792 | } |
793 | 793 | if ($cookie['port']) { |
794 | - $cookieHeader .= ' $Port="' . $cookie['port'] . '";'; |
|
794 | + $cookieHeader .= ' $Port="'.$cookie['port'].'";'; |
|
795 | 795 | } |
796 | 796 | } else { |
797 | - $cookieHeader .= ' ' . $name . '=' . $cookie['value'] . ";"; |
|
797 | + $cookieHeader .= ' '.$name.'='.$cookie['value'].";"; |
|
798 | 798 | } |
799 | 799 | } |
800 | - $cookieHeader = 'Cookie:' . $version . substr($cookieHeader, 0, -1) . "\r\n"; |
|
800 | + $cookieHeader = 'Cookie:'.$version.substr($cookieHeader, 0, -1)."\r\n"; |
|
801 | 801 | } |
802 | 802 | |
803 | 803 | // omit port if default |
804 | 804 | if (($port == 80 && in_array($method, array('http', 'http10'))) || ($port == 443 && $method == 'https')) { |
805 | - $port = ''; |
|
805 | + $port = ''; |
|
806 | 806 | } else { |
807 | - $port = ':' . $port; |
|
807 | + $port = ':'.$port; |
|
808 | 808 | } |
809 | 809 | |
810 | - $op = 'POST ' . $uri . " HTTP/1.0\r\n" . |
|
811 | - 'User-Agent: ' . $this->user_agent . "\r\n" . |
|
812 | - 'Host: ' . $server . $port . "\r\n" . |
|
813 | - $credentials . |
|
814 | - $proxyCredentials . |
|
815 | - $acceptedEncoding . |
|
816 | - $encodingHdr . |
|
817 | - 'Accept-Charset: ' . implode(',', $this->accepted_charset_encodings) . "\r\n" . |
|
818 | - $cookieHeader . |
|
819 | - 'Content-Type: ' . $req->content_type . "\r\nContent-Length: " . |
|
820 | - strlen($payload) . "\r\n\r\n" . |
|
810 | + $op = 'POST '.$uri." HTTP/1.0\r\n". |
|
811 | + 'User-Agent: '.$this->user_agent."\r\n". |
|
812 | + 'Host: '.$server.$port."\r\n". |
|
813 | + $credentials. |
|
814 | + $proxyCredentials. |
|
815 | + $acceptedEncoding. |
|
816 | + $encodingHdr. |
|
817 | + 'Accept-Charset: '.implode(',', $this->accepted_charset_encodings)."\r\n". |
|
818 | + $cookieHeader. |
|
819 | + 'Content-Type: '.$req->content_type."\r\nContent-Length: ". |
|
820 | + strlen($payload)."\r\n\r\n". |
|
821 | 821 | $payload; |
822 | 822 | |
823 | - if ($this->debug > 1) { |
|
823 | + if ($this->debug>1) { |
|
824 | 824 | $this->getLogger()->debugMessage("---SENDING---\n$op\n---END---"); |
825 | 825 | } |
826 | 826 | |
@@ -847,7 +847,7 @@ discard block |
||
847 | 847 | |
848 | 848 | $context = stream_context_create($contextOptions); |
849 | 849 | |
850 | - if ($timeout <= 0) { |
|
850 | + if ($timeout<=0) { |
|
851 | 851 | $connectTimeout = ini_get('default_socket_timeout'); |
852 | 852 | } else { |
853 | 853 | $connectTimeout = $timeout; |
@@ -859,7 +859,7 @@ discard block |
||
859 | 859 | $fp = @stream_socket_client("$transport://$connectServer:$connectPort", $this->errno, $this->errstr, $connectTimeout, |
860 | 860 | STREAM_CLIENT_CONNECT, $context); |
861 | 861 | if ($fp) { |
862 | - if ($timeout > 0) { |
|
862 | + if ($timeout>0) { |
|
863 | 863 | stream_set_timeout($fp, $timeout, 0); |
864 | 864 | } |
865 | 865 | } else { |
@@ -868,8 +868,8 @@ discard block |
||
868 | 868 | $this->errstr = $err['message']; |
869 | 869 | } |
870 | 870 | |
871 | - $this->errstr = 'Connect error: ' . $this->errstr; |
|
872 | - $r = new Response(0, PhpXmlRpc::$xmlrpcerr['http_error'], $this->errstr . ' (' . $this->errno . ')'); |
|
871 | + $this->errstr = 'Connect error: '.$this->errstr; |
|
872 | + $r = new Response(0, PhpXmlRpc::$xmlrpcerr['http_error'], $this->errstr.' ('.$this->errno.')'); |
|
873 | 873 | |
874 | 874 | return $r; |
875 | 875 | } |
@@ -957,18 +957,18 @@ discard block |
||
957 | 957 | $keyPass, $sslVersion); |
958 | 958 | |
959 | 959 | if (!$curl) { |
960 | - return new Response(0, PhpXmlRpc::$xmlrpcerr['curl_fail'], PhpXmlRpc::$xmlrpcstr['curl_fail'] . ': error during curl initialization. Check php error log for details'); |
|
960 | + return new Response(0, PhpXmlRpc::$xmlrpcerr['curl_fail'], PhpXmlRpc::$xmlrpcstr['curl_fail'].': error during curl initialization. Check php error log for details'); |
|
961 | 961 | } |
962 | 962 | |
963 | 963 | $result = curl_exec($curl); |
964 | 964 | |
965 | - if ($this->debug > 1) { |
|
965 | + if ($this->debug>1) { |
|
966 | 966 | $message = "---CURL INFO---\n"; |
967 | 967 | foreach (curl_getinfo($curl) as $name => $val) { |
968 | 968 | if (is_array($val)) { |
969 | 969 | $val = implode("\n", $val); |
970 | 970 | } |
971 | - $message .= $name . ': ' . $val . "\n"; |
|
971 | + $message .= $name.': '.$val."\n"; |
|
972 | 972 | } |
973 | 973 | $message .= '---END---'; |
974 | 974 | $this->getLogger()->debugMessage($message); |
@@ -978,7 +978,7 @@ discard block |
||
978 | 978 | /// @todo we should use a better check here - what if we get back '' or '0'? |
979 | 979 | |
980 | 980 | $this->errstr = 'no response'; |
981 | - $resp = new Response(0, PhpXmlRpc::$xmlrpcerr['curl_fail'], PhpXmlRpc::$xmlrpcstr['curl_fail'] . ': ' . curl_error($curl)); |
|
981 | + $resp = new Response(0, PhpXmlRpc::$xmlrpcerr['curl_fail'], PhpXmlRpc::$xmlrpcstr['curl_fail'].': '.curl_error($curl)); |
|
982 | 982 | curl_close($curl); |
983 | 983 | if ($keepAlive) { |
984 | 984 | $this->xmlrpc_curl_handle = null; |
@@ -1048,12 +1048,12 @@ discard block |
||
1048 | 1048 | // http, https |
1049 | 1049 | $protocol = $method; |
1050 | 1050 | if (strpos($protocol, ':') !== false) { |
1051 | - $this->getLogger()->errorLog('XML-RPC: ' . __METHOD__ . ": warning - attempted hacking attempt?. The curl protocol requested for the call is: '$protocol'"); |
|
1051 | + $this->getLogger()->errorLog('XML-RPC: '.__METHOD__.": warning - attempted hacking attempt?. The curl protocol requested for the call is: '$protocol'"); |
|
1052 | 1052 | return false; |
1053 | 1053 | } |
1054 | 1054 | } |
1055 | 1055 | } |
1056 | - $curl = curl_init($protocol . '://' . $server . ':' . $port . $this->path); |
|
1056 | + $curl = curl_init($protocol.'://'.$server.':'.$port.$this->path); |
|
1057 | 1057 | if (!$curl) { |
1058 | 1058 | return false; |
1059 | 1059 | } |
@@ -1067,7 +1067,7 @@ discard block |
||
1067 | 1067 | // results into variable |
1068 | 1068 | curl_setopt($curl, CURLOPT_RETURNTRANSFER, true); |
1069 | 1069 | |
1070 | - if ($this->debug > 1) { |
|
1070 | + if ($this->debug>1) { |
|
1071 | 1071 | curl_setopt($curl, CURLOPT_VERBOSE, true); |
1072 | 1072 | /// @todo allow callers to redirect curlopt_stderr to some stream which can be buffered |
1073 | 1073 | } |
@@ -1092,7 +1092,7 @@ discard block |
||
1092 | 1092 | } |
1093 | 1093 | } |
1094 | 1094 | // extra headers |
1095 | - $headers = array('Content-Type: ' . $req->content_type, 'Accept-Charset: ' . implode(',', $this->accepted_charset_encodings)); |
|
1095 | + $headers = array('Content-Type: '.$req->content_type, 'Accept-Charset: '.implode(',', $this->accepted_charset_encodings)); |
|
1096 | 1096 | // if no keepalive is wanted, let the server know it in advance |
1097 | 1097 | if (!$keepAlive) { |
1098 | 1098 | $headers[] = 'Connection: close'; |
@@ -1109,7 +1109,7 @@ discard block |
||
1109 | 1109 | curl_setopt($curl, CURLOPT_HTTPHEADER, $headers); |
1110 | 1110 | // timeout is borked |
1111 | 1111 | if ($timeout) { |
1112 | - curl_setopt($curl, CURLOPT_TIMEOUT, $timeout == 1 ? 1 : $timeout - 1); |
|
1112 | + curl_setopt($curl, CURLOPT_TIMEOUT, $timeout == 1 ? 1 : $timeout-1); |
|
1113 | 1113 | } |
1114 | 1114 | |
1115 | 1115 | switch ($method) { |
@@ -1124,7 +1124,7 @@ discard block |
||
1124 | 1124 | curl_setopt($curl, CURLOPT_HTTP_VERSION, CURL_HTTP_VERSION_2_PRIOR_KNOWLEDGE); |
1125 | 1125 | } else { |
1126 | 1126 | /// @todo make this a proper error, ie. return a failure |
1127 | - $this->getLogger()->errorLog('XML-RPC: ' . __METHOD__ . ': warning. HTTP2 is not supported by the current PHP/curl install'); |
|
1127 | + $this->getLogger()->errorLog('XML-RPC: '.__METHOD__.': warning. HTTP2 is not supported by the current PHP/curl install'); |
|
1128 | 1128 | } |
1129 | 1129 | break; |
1130 | 1130 | case 'h2': |
@@ -1133,12 +1133,12 @@ discard block |
||
1133 | 1133 | } |
1134 | 1134 | |
1135 | 1135 | if ($username && $password) { |
1136 | - curl_setopt($curl, CURLOPT_USERPWD, $username . ':' . $password); |
|
1136 | + curl_setopt($curl, CURLOPT_USERPWD, $username.':'.$password); |
|
1137 | 1137 | if (defined('CURLOPT_HTTPAUTH')) { |
1138 | 1138 | curl_setopt($curl, CURLOPT_HTTPAUTH, $authType); |
1139 | 1139 | } elseif ($authType != 1) { |
1140 | 1140 | /// @todo make this a proper error, ie. return a failure |
1141 | - $this->getLogger()->errorLog('XML-RPC: ' . __METHOD__ . ': warning. Only Basic auth is supported by the current PHP/curl install'); |
|
1141 | + $this->getLogger()->errorLog('XML-RPC: '.__METHOD__.': warning. Only Basic auth is supported by the current PHP/curl install'); |
|
1142 | 1142 | } |
1143 | 1143 | } |
1144 | 1144 | |
@@ -1181,14 +1181,14 @@ discard block |
||
1181 | 1181 | if ($proxyPort == 0) { |
1182 | 1182 | $proxyPort = 8080; // NB: even for HTTPS, local connection is on port 8080 |
1183 | 1183 | } |
1184 | - curl_setopt($curl, CURLOPT_PROXY, $proxyHost . ':' . $proxyPort); |
|
1184 | + curl_setopt($curl, CURLOPT_PROXY, $proxyHost.':'.$proxyPort); |
|
1185 | 1185 | if ($proxyUsername) { |
1186 | - curl_setopt($curl, CURLOPT_PROXYUSERPWD, $proxyUsername . ':' . $proxyPassword); |
|
1186 | + curl_setopt($curl, CURLOPT_PROXYUSERPWD, $proxyUsername.':'.$proxyPassword); |
|
1187 | 1187 | if (defined('CURLOPT_PROXYAUTH')) { |
1188 | 1188 | curl_setopt($curl, CURLOPT_PROXYAUTH, $proxyAuthType); |
1189 | 1189 | } elseif ($proxyAuthType != 1) { |
1190 | 1190 | /// @todo make this a proper error, ie. return a failure |
1191 | - $this->getLogger()->errorLog('XML-RPC: ' . __METHOD__ . ': warning. Only Basic auth to proxy is supported by the current PHP/curl install'); |
|
1191 | + $this->getLogger()->errorLog('XML-RPC: '.__METHOD__.': warning. Only Basic auth to proxy is supported by the current PHP/curl install'); |
|
1192 | 1192 | } |
1193 | 1193 | } |
1194 | 1194 | } |
@@ -1198,7 +1198,7 @@ discard block |
||
1198 | 1198 | if (count($this->cookies)) { |
1199 | 1199 | $cookieHeader = ''; |
1200 | 1200 | foreach ($this->cookies as $name => $cookie) { |
1201 | - $cookieHeader .= $name . '=' . $cookie['value'] . '; '; |
|
1201 | + $cookieHeader .= $name.'='.$cookie['value'].'; '; |
|
1202 | 1202 | } |
1203 | 1203 | curl_setopt($curl, CURLOPT_COOKIE, substr($cookieHeader, 0, -2)); |
1204 | 1204 | } |
@@ -1207,7 +1207,7 @@ discard block |
||
1207 | 1207 | curl_setopt($curl, $opt, $val); |
1208 | 1208 | } |
1209 | 1209 | |
1210 | - if ($this->debug > 1) { |
|
1210 | + if ($this->debug>1) { |
|
1211 | 1211 | $this->getLogger()->debugMessage("---SENDING---\n$payload\n---END---"); |
1212 | 1212 | } |
1213 | 1213 | |
@@ -1305,7 +1305,7 @@ discard block |
||
1305 | 1305 | $call['methodName'] = new Value($req->method(), 'string'); |
1306 | 1306 | $numParams = $req->getNumParams(); |
1307 | 1307 | $params = array(); |
1308 | - for ($i = 0; $i < $numParams; $i++) { |
|
1308 | + for ($i = 0; $i<$numParams; $i++) { |
|
1309 | 1309 | $params[$i] = $req->getParam($i); |
1310 | 1310 | } |
1311 | 1311 | $call['params'] = new Value($params, 'array'); |
@@ -1330,15 +1330,15 @@ discard block |
||
1330 | 1330 | } elseif ($this->return_type == 'phpvals') { |
1331 | 1331 | /// @todo test this code branch... |
1332 | 1332 | if (!is_array($rets)) { |
1333 | - return false; // bad return type from system.multicall |
|
1333 | + return false; // bad return type from system.multicall |
|
1334 | 1334 | } |
1335 | 1335 | $numRets = count($rets); |
1336 | 1336 | if ($numRets != count($reqs)) { |
1337 | - return false; // wrong number of return values. |
|
1337 | + return false; // wrong number of return values. |
|
1338 | 1338 | } |
1339 | 1339 | |
1340 | 1340 | $response = array(); |
1341 | - for ($i = 0; $i < $numRets; $i++) { |
|
1341 | + for ($i = 0; $i<$numRets; $i++) { |
|
1342 | 1342 | $val = $rets[$i]; |
1343 | 1343 | if (!is_array($val)) { |
1344 | 1344 | return false; |
@@ -1346,7 +1346,7 @@ discard block |
||
1346 | 1346 | switch (count($val)) { |
1347 | 1347 | case 1: |
1348 | 1348 | if (!isset($val[0])) { |
1349 | - return false; // Bad value |
|
1349 | + return false; // Bad value |
|
1350 | 1350 | } |
1351 | 1351 | // Normal return value |
1352 | 1352 | $response[$i] = new Response($val[0], 0, '', 'phpvals'); |
@@ -1372,11 +1372,11 @@ discard block |
||
1372 | 1372 | } else { |
1373 | 1373 | // return type == 'xmlrpcvals' |
1374 | 1374 | if ($rets->kindOf() != 'array') { |
1375 | - return false; // bad return type from system.multicall |
|
1375 | + return false; // bad return type from system.multicall |
|
1376 | 1376 | } |
1377 | 1377 | $numRets = $rets->count(); |
1378 | 1378 | if ($numRets != count($reqs)) { |
1379 | - return false; // wrong number of return values. |
|
1379 | + return false; // wrong number of return values. |
|
1380 | 1380 | } |
1381 | 1381 | |
1382 | 1382 | $response = array(); |
@@ -1384,7 +1384,7 @@ discard block |
||
1384 | 1384 | switch ($val->kindOf()) { |
1385 | 1385 | case 'array': |
1386 | 1386 | if ($val->count() != 1) { |
1387 | - return false; // Bad value |
|
1387 | + return false; // Bad value |
|
1388 | 1388 | } |
1389 | 1389 | // Normal return value |
1390 | 1390 | $response[] = new Response($val[0]); |
@@ -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; |
@@ -24,7 +24,7 @@ discard block |
||
24 | 24 | $handles = array(); |
25 | 25 | $curl = curl_multi_init(); |
26 | 26 | |
27 | - foreach($requests as $k => $req) { |
|
27 | + foreach ($requests as $k => $req) { |
|
28 | 28 | $req->setDebug($this->debug); |
29 | 29 | |
30 | 30 | $handle = $this->prepareCurlHandle( |
@@ -57,19 +57,19 @@ discard block |
||
57 | 57 | $running = 0; |
58 | 58 | do { |
59 | 59 | curl_multi_exec($curl, $running); |
60 | - } while($running > 0); |
|
60 | + } while ($running>0); |
|
61 | 61 | |
62 | 62 | $responses = array(); |
63 | - foreach($handles as $k => $h) { |
|
63 | + foreach ($handles as $k => $h) { |
|
64 | 64 | $responses[$k] = curl_multi_getcontent($handles[$k]); |
65 | 65 | |
66 | - if ($this->debug > 1) { |
|
66 | + if ($this->debug>1) { |
|
67 | 67 | $message = "---CURL INFO---\n"; |
68 | 68 | foreach (curl_getinfo($h) as $name => $val) { |
69 | 69 | if (is_array($val)) { |
70 | 70 | $val = implode("\n", $val); |
71 | 71 | } |
72 | - $message .= $name . ': ' . $val . "\n"; |
|
72 | + $message .= $name.': '.$val."\n"; |
|
73 | 73 | } |
74 | 74 | $message .= '---END---'; |
75 | 75 | $this->getLogger()->debugMessage($message); |
@@ -80,9 +80,9 @@ discard block |
||
80 | 80 | } |
81 | 81 | curl_multi_close($curl); |
82 | 82 | |
83 | - foreach($responses as $k => $resp) { |
|
83 | + foreach ($responses as $k => $resp) { |
|
84 | 84 | if (!$resp) { |
85 | - $responses[$k] = new Response(0, PhpXmlRpc::$xmlrpcerr['curl_fail'], PhpXmlRpc::$xmlrpcstr['curl_fail'] . ': ' . curl_error($curl)); |
|
85 | + $responses[$k] = new Response(0, PhpXmlRpc::$xmlrpcerr['curl_fail'], PhpXmlRpc::$xmlrpcstr['curl_fail'].': '.curl_error($curl)); |
|
86 | 86 | } else { |
87 | 87 | $responses[$k] = $requests[$k]->parseResponse($resp, true, $this->return_type); |
88 | 88 | } |
@@ -99,7 +99,7 @@ discard block |
||
99 | 99 | $value = $encoder->encode($data, array('auto_dates')); |
100 | 100 | $req = new Request('interopEchoTests.echoValue', array($value)); |
101 | 101 | $reqs = array(); |
102 | -for ($i = 0; $i < $num_tests; $i++) { |
|
102 | +for ($i = 0; $i<$num_tests; $i++) { |
|
103 | 103 | $reqs[] = $req; |
104 | 104 | } |
105 | 105 | |
@@ -114,18 +114,18 @@ discard block |
||
114 | 114 | |
115 | 115 | $t = microtime(true); |
116 | 116 | $resp = $client->send($reqs); |
117 | -$t = microtime(true) - $t; |
|
118 | -echo "Sequential send: " . sprintf('%.3f', $t) . " secs.\n"; |
|
117 | +$t = microtime(true)-$t; |
|
118 | +echo "Sequential send: ".sprintf('%.3f', $t)." secs.\n"; |
|
119 | 119 | flush(); |
120 | 120 | |
121 | 121 | $t = microtime(true); |
122 | 122 | $resp = $client->sendParallel($reqs); |
123 | -$t = microtime(true) - $t; |
|
124 | -echo "Parallel send: " . sprintf('%.3f', $t) . " secs.\n"; |
|
123 | +$t = microtime(true)-$t; |
|
124 | +echo "Parallel send: ".sprintf('%.3f', $t)." secs.\n"; |
|
125 | 125 | flush(); |
126 | 126 | |
127 | 127 | $client->no_multicall = false; |
128 | 128 | $t = microtime(true); |
129 | 129 | $resp = $client->send($reqs); |
130 | -$t = microtime(true) - $t; |
|
131 | -echo "Multicall send: " . sprintf('%.3f', $t) . " secs.\n"; |
|
130 | +$t = microtime(true)-$t; |
|
131 | +echo "Multicall send: ".sprintf('%.3f', $t)." secs.\n"; |
@@ -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 |
@@ -13,8 +13,8 @@ discard block |
||
13 | 13 | $this->args = argParser::getArgs(); |
14 | 14 | |
15 | 15 | // assumes HTTPURI to be in the form /tests/index.php?etc... |
16 | - $this->baseUrl = $this->args['HTTPSERVER'] . preg_replace('|\?.+|', '', $this->args['HTTPURI']); |
|
17 | - $this->coverageScriptUrl = 'http://' . $this->args['HTTPSERVER'] . preg_replace('|/tests/index\.php(\?.*)?|', '/tests/phpunit_coverage.php', $this->args['HTTPURI']); |
|
16 | + $this->baseUrl = $this->args['HTTPSERVER'].preg_replace('|\?.+|', '', $this->args['HTTPURI']); |
|
17 | + $this->coverageScriptUrl = 'http://'.$this->args['HTTPSERVER'].preg_replace('|/tests/index\.php(\?.*)?|', '/tests/phpunit_coverage.php', $this->args['HTTPURI']); |
|
18 | 18 | } |
19 | 19 | |
20 | 20 | public function testBenchmark() |
@@ -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 'demo' 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 = $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 = $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 testAgeSort() |
@@ -6,7 +6,7 @@ |
||
6 | 6 | * @license code licensed under the BSD License: see file license.txt |
7 | 7 | **/ |
8 | 8 | |
9 | -$coverageFile = realpath(__DIR__ . "/../vendor/phpunit/phpunit-selenium/PHPUnit/Extensions/SeleniumCommon/phpunit_coverage.php"); |
|
9 | +$coverageFile = realpath(__DIR__."/../vendor/phpunit/phpunit-selenium/PHPUnit/Extensions/SeleniumCommon/phpunit_coverage.php"); |
|
10 | 10 | |
11 | 11 | // has to be the same value as used in index.php |
12 | 12 | $GLOBALS['PHPUNIT_COVERAGE_DATA_DIRECTORY'] = '/tmp/phpxmlrpc_coverage'; |
@@ -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 | class DebuggerTest extends PhpXmlRpc_WebTestCase |
6 | 6 | { |
@@ -9,8 +9,8 @@ discard block |
||
9 | 9 | $this->args = argParser::getArgs(); |
10 | 10 | |
11 | 11 | // assumes HTTPURI to be in the form /tests/index.php?etc... |
12 | - $this->baseUrl = $this->args['HTTPSERVER'] . preg_replace('|\?.+|', '', $this->args['HTTPURI']); |
|
13 | - $this->coverageScriptUrl = 'http://' . $this->args['HTTPSERVER'] . preg_replace('|/tests/index\.php(\?.*)?|', '/tests/phpunit_coverage.php', $this->args['HTTPURI']); |
|
12 | + $this->baseUrl = $this->args['HTTPSERVER'].preg_replace('|\?.+|', '', $this->args['HTTPURI']); |
|
13 | + $this->coverageScriptUrl = 'http://'.$this->args['HTTPSERVER'].preg_replace('|/tests/index\.php(\?.*)?|', '/tests/phpunit_coverage.php', $this->args['HTTPURI']); |
|
14 | 14 | } |
15 | 15 | |
16 | 16 | public function testIndex() |
@@ -46,7 +46,7 @@ discard block |
||
46 | 46 | // check for command line params (passed as env vars) vs. web page input params (passed as GET/POST) |
47 | 47 | // Note that the only usecase for web-page mode is when this is used by benchmark.php |
48 | 48 | if (!isset($_SERVER['REQUEST_METHOD'])) { |
49 | - foreach($_SERVER as $key => $val) { |
|
49 | + foreach ($_SERVER as $key => $val) { |
|
50 | 50 | if (array_key_exists($key, $args)) { |
51 | 51 | $$key = $val; |
52 | 52 | } |
@@ -91,7 +91,7 @@ discard block |
||
91 | 91 | //} |
92 | 92 | } |
93 | 93 | if ($HTTPURI[0] != '/') { |
94 | - $HTTPURI = '/' . $HTTPURI; |
|
94 | + $HTTPURI = '/'.$HTTPURI; |
|
95 | 95 | } |
96 | 96 | $args['HTTPURI'] = $HTTPURI; |
97 | 97 | |
@@ -105,21 +105,21 @@ discard block |
||
105 | 105 | } |
106 | 106 | |
107 | 107 | if (isset($HTTPSIGNOREPEER)) { |
108 | - $args['HTTPSIGNOREPEER'] = (bool)$HTTPSIGNOREPEER; |
|
108 | + $args['HTTPSIGNOREPEER'] = (bool) $HTTPSIGNOREPEER; |
|
109 | 109 | } |
110 | 110 | |
111 | 111 | if (isset($HTTPSVERIFYHOST)) { |
112 | - $args['HTTPSVERIFYHOST'] = (int)$HTTPSVERIFYHOST; |
|
112 | + $args['HTTPSVERIFYHOST'] = (int) $HTTPSVERIFYHOST; |
|
113 | 113 | } |
114 | 114 | |
115 | 115 | if (isset($SSLVERSION)) { |
116 | - $args['SSLVERSION'] = (int)$SSLVERSION; |
|
116 | + $args['SSLVERSION'] = (int) $SSLVERSION; |
|
117 | 117 | } |
118 | 118 | |
119 | 119 | if (isset($PROXYSERVER)) { |
120 | 120 | $arr = explode(':', $PROXYSERVER); |
121 | 121 | $args['PROXYSERVER'] = $arr[0]; |
122 | - if (count($arr) > 1) { |
|
122 | + if (count($arr)>1) { |
|
123 | 123 | $args['PROXYPORT'] = $arr[1]; |
124 | 124 | } else { |
125 | 125 | $args['PROXYPORT'] = 8080; |
@@ -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,7 +106,7 @@ 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 | if ($this->args['DEBUG'] == 1) |
112 | 112 | ob_start(); |
@@ -143,9 +143,9 @@ discard block |
||
143 | 143 | } |
144 | 144 | $this->validateResponse($r); |
145 | 145 | if (is_array($errorCode)) { |
146 | - $this->assertContains($r->faultCode(), $errorCode, 'Error ' . $r->faultCode() . ' connecting to server: ' . $r->faultString()); |
|
146 | + $this->assertContains($r->faultCode(), $errorCode, 'Error '.$r->faultCode().' connecting to server: '.$r->faultString()); |
|
147 | 147 | } else { |
148 | - $this->assertEquals($errorCode, $r->faultCode(), 'Error ' . $r->faultCode() . ' connecting to server: ' . $r->faultString()); |
|
148 | + $this->assertEquals($errorCode, $r->faultCode(), 'Error '.$r->faultCode().' connecting to server: '.$r->faultString()); |
|
149 | 149 | } |
150 | 150 | if (!$r->faultCode()) { |
151 | 151 | if ($returnResponse) { |
@@ -172,20 +172,20 @@ discard block |
||
172 | 172 | $query = parse_url($this->client->path, PHP_URL_QUERY); |
173 | 173 | parse_str($query, $vars); |
174 | 174 | $query = http_build_query(array_merge($vars, $data)); |
175 | - $this->client->path = parse_url($this->client->path, PHP_URL_PATH) . '?' . $query; |
|
175 | + $this->client->path = parse_url($this->client->path, PHP_URL_PATH).'?'.$query; |
|
176 | 176 | } |
177 | 177 | |
178 | 178 | public function testString() |
179 | 179 | { |
180 | - $sendString = "here are 3 \"entities\": < > & " . |
|
181 | - "and here's a dollar sign: \$pretendvarname and a backslash too: " . chr(92) . |
|
182 | - " - isn't that great? \\\"hackery\\\" at it's best " . |
|
183 | - " also don't want to miss out on \$item[0]. " . |
|
184 | - "The real weird stuff follows: CRLF here" . chr(13) . chr(10) . |
|
185 | - "a simple CR here" . chr(13) . |
|
186 | - "a simple LF here" . chr(10) . |
|
187 | - "and then LFCR" . chr(10) . chr(13) . |
|
188 | - "last but not least weird names: G" . chr(252) . "nter, El" . chr(232) . "ne, and an xml comment closing tag: -->"; |
|
180 | + $sendString = "here are 3 \"entities\": < > & ". |
|
181 | + "and here's a dollar sign: \$pretendvarname and a backslash too: ".chr(92). |
|
182 | + " - isn't that great? \\\"hackery\\\" at it's best ". |
|
183 | + " also don't want to miss out on \$item[0]. ". |
|
184 | + "The real weird stuff follows: CRLF here".chr(13).chr(10). |
|
185 | + "a simple CR here".chr(13). |
|
186 | + "a simple LF here".chr(10). |
|
187 | + "and then LFCR".chr(10).chr(13). |
|
188 | + "last but not least weird names: G".chr(252)."nter, El".chr(232)."ne, and an xml comment closing tag: -->"; |
|
189 | 189 | $m = new xmlrpcmsg('examples.stringecho', array( |
190 | 190 | new xmlrpcval($sendString, 'string'), |
191 | 191 | )); |
@@ -206,7 +206,7 @@ discard block |
||
206 | 206 | public function testLatin1String() |
207 | 207 | { |
208 | 208 | $sendString = |
209 | - "last but not least weird names: G" . chr(252) . "nter, El" . chr(232) . "ne"; |
|
209 | + "last but not least weird names: G".chr(252)."nter, El".chr(232)."ne"; |
|
210 | 210 | $x = '<?xml version="1.0" encoding="ISO-8859-1"?><methodCall><methodName>examples.stringecho</methodName><params><param><value>'. |
211 | 211 | $sendString. |
212 | 212 | '</value></param></params></methodCall>'; |
@@ -315,7 +315,7 @@ discard block |
||
315 | 315 | public function testUtf8Method() |
316 | 316 | { |
317 | 317 | PhpXmlRpc\PhpXmlRpc::$xmlrpc_internalencoding = 'UTF-8'; |
318 | - $m = new xmlrpcmsg("tests.utf8methodname." . 'κόσμε', array( |
|
318 | + $m = new xmlrpcmsg("tests.utf8methodname.".'κόσμε', array( |
|
319 | 319 | new xmlrpcval('hello') |
320 | 320 | )); |
321 | 321 | $v = $this->send($m); |
@@ -337,7 +337,7 @@ discard block |
||
337 | 337 | )); |
338 | 338 | $v = $this->send($m); |
339 | 339 | if ($v) { |
340 | - $this->assertEquals($a + $b, $v->scalarval()); |
|
340 | + $this->assertEquals($a+$b, $v->scalarval()); |
|
341 | 341 | } |
342 | 342 | } |
343 | 343 | |
@@ -349,7 +349,7 @@ discard block |
||
349 | 349 | )); |
350 | 350 | $v = $this->send($m); |
351 | 351 | if ($v) { |
352 | - $this->assertEquals(12 - 23, $v->scalarval()); |
|
352 | + $this->assertEquals(12-23, $v->scalarval()); |
|
353 | 353 | } |
354 | 354 | } |
355 | 355 | |
@@ -383,7 +383,7 @@ discard block |
||
383 | 383 | if ($v) { |
384 | 384 | $sz = $v->arraysize(); |
385 | 385 | $got = ''; |
386 | - for ($i = 0; $i < $sz; $i++) { |
|
386 | + for ($i = 0; $i<$sz; $i++) { |
|
387 | 387 | $b = $v->arraymem($i); |
388 | 388 | if ($b->scalarval()) { |
389 | 389 | $got .= '1'; |
@@ -446,7 +446,7 @@ discard block |
||
446 | 446 | $got = ''; |
447 | 447 | $expected = '37210'; |
448 | 448 | $expect_array = array('ctLeftAngleBrackets', 'ctRightAngleBrackets', 'ctAmpersands', 'ctApostrophes', 'ctQuotes'); |
449 | - foreach($expect_array as $val) { |
|
449 | + foreach ($expect_array as $val) { |
|
450 | 450 | $b = $v->structmem($val); |
451 | 451 | $got .= $b->me['int']; |
452 | 452 | } |
@@ -899,7 +899,7 @@ discard block |
||
899 | 899 | { |
900 | 900 | // make a 'deep client copy' as the original one might have many properties set |
901 | 901 | // also for speed only wrap one method of the whole server |
902 | - $class = wrap_xmlrpc_server($this->client, array('simple_client_copy' => 0, 'method_filter' => '/examples\.getStateName/' )); |
|
902 | + $class = wrap_xmlrpc_server($this->client, array('simple_client_copy' => 0, 'method_filter' => '/examples\.getStateName/')); |
|
903 | 903 | if ($class == '') { |
904 | 904 | $this->fail('Registration of remote server failed'); |
905 | 905 | } else { |
@@ -938,9 +938,9 @@ discard block |
||
938 | 938 | $cookies = array( |
939 | 939 | //'c1' => array(), |
940 | 940 | 'c2' => array('value' => 'c2'), |
941 | - 'c3' => array('value' => 'c3', 'expires' => time() + 60 * 60 * 24 * 30), |
|
942 | - 'c4' => array('value' => 'c4', 'expires' => time() + 60 * 60 * 24 * 30, 'path' => '/'), |
|
943 | - 'c5' => array('value' => 'c5', 'expires' => time() + 60 * 60 * 24 * 30, 'path' => '/', 'domain' => 'localhost'), |
|
941 | + 'c3' => array('value' => 'c3', 'expires' => time()+60 * 60 * 24 * 30), |
|
942 | + 'c4' => array('value' => 'c4', 'expires' => time()+60 * 60 * 24 * 30, 'path' => '/'), |
|
943 | + 'c5' => array('value' => 'c5', 'expires' => time()+60 * 60 * 24 * 30, 'path' => '/', 'domain' => 'localhost'), |
|
944 | 944 | ); |
945 | 945 | $cookiesval = php_xmlrpc_encode($cookies); |
946 | 946 | $m = new xmlrpcmsg('tests.setcookies', array($cookiesval)); |
@@ -988,10 +988,10 @@ discard block |
||
988 | 988 | $m = new xmlrpcmsg('tests.getcookies', array()); |
989 | 989 | foreach ($cookies as $cookie => $val) { |
990 | 990 | $this->client->setCookie($cookie, $val); |
991 | - $cookies[$cookie] = (string)$cookies[$cookie]; |
|
991 | + $cookies[$cookie] = (string) $cookies[$cookie]; |
|
992 | 992 | } |
993 | 993 | $r = $this->client->send($m, $this->timeout, $this->method); |
994 | - $this->assertEquals(0, $r->faultCode(), 'Error ' . $r->faultCode() . ' connecting to server: ' . $r->faultString()); |
|
994 | + $this->assertEquals(0, $r->faultCode(), 'Error '.$r->faultCode().' connecting to server: '.$r->faultString()); |
|
995 | 995 | if (!$r->faultCode()) { |
996 | 996 | $v = $r->value(); |
997 | 997 | $v = php_xmlrpc_decode($v); |
@@ -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,23 +10,23 @@ 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: <PRE>" . htmlentities($v->serialize()) . "</PRE>"); |
|
25 | +output("Datetime: <PRE>".htmlentities($v->serialize())."</PRE>"); |
|
26 | 26 | |
27 | 27 | $v = new PhpXmlRpc\Value('hello world', 'base64'); |
28 | -output("Base64: <PRE>" . htmlentities($v->serialize()) . "</PRE>"); |
|
29 | -output("(value of base64 string is: '" . $v->scalarval() . "')<BR><BR>"); |
|
28 | +output("Base64: <PRE>".htmlentities($v->serialize())."</PRE>"); |
|
29 | +output("(value of base64 string is: '".$v->scalarval()."')<BR><BR>"); |
|
30 | 30 | |
31 | 31 | $v = new PhpXmlRpc\Value( |
32 | 32 | array( |
@@ -39,7 +39,7 @@ discard block |
||
39 | 39 | ), |
40 | 40 | "array" |
41 | 41 | ); |
42 | -output("Array: <PRE>" . htmlentities($v->serialize()) . "</PRE>"); |
|
42 | +output("Array: <PRE>".htmlentities($v->serialize())."</PRE>"); |
|
43 | 43 | |
44 | 44 | $v = new PhpXmlRpc\Value( |
45 | 45 | array( |
@@ -59,10 +59,10 @@ discard block |
||
59 | 59 | ), |
60 | 60 | "struct" |
61 | 61 | ); |
62 | -output("Struct: <PRE>" . htmlentities($v->serialize()) . "</PRE>"); |
|
62 | +output("Struct: <PRE>".htmlentities($v->serialize())."</PRE>"); |
|
63 | 63 | |
64 | 64 | $w = new PhpXmlRpc\Value(array($v), 'array'); |
65 | -output("Array containing a struct: <PRE>" . htmlentities($w->serialize()) . "</PRE>"); |
|
65 | +output("Array containing a struct: <PRE>".htmlentities($w->serialize())."</PRE>"); |
|
66 | 66 | |
67 | 67 | class MyClass |
68 | 68 | { |
@@ -74,46 +74,46 @@ discard block |
||
74 | 74 | // the public property is the only one which will be serialized. As such, it has to be of type Value |
75 | 75 | $myObject->public = new \PhpXmlRpc\Value('a public property, wrapped'); |
76 | 76 | $w = new PhpXmlRpc\Value($myObject, 'struct'); |
77 | -output("Struct encoding a php object: <PRE>" . htmlentities($w->serialize()) . "</PRE>"); |
|
77 | +output("Struct encoding a php object: <PRE>".htmlentities($w->serialize())."</PRE>"); |
|
78 | 78 | |
79 | 79 | output("<h3>Testing value serialization - xml-rpc extensions</h3>\n"); |
80 | 80 | $v = new PhpXmlRpc\Value(1234, 'i8'); |
81 | -output("I8: <PRE>" . htmlentities($v->serialize()) . "</PRE>"); |
|
81 | +output("I8: <PRE>".htmlentities($v->serialize())."</PRE>"); |
|
82 | 82 | $v = new PhpXmlRpc\Value(null, 'null'); |
83 | -output("Null: <PRE>" . htmlentities($v->serialize()) . "</PRE>"); |
|
83 | +output("Null: <PRE>".htmlentities($v->serialize())."</PRE>"); |
|
84 | 84 | \PhpXmlRpc\PhpXmlRpc::$xmlrpc_null_apache_encoding = true; |
85 | -output("Null, alternative: <PRE>" . htmlentities($v->serialize()) . "</PRE>"); |
|
85 | +output("Null, alternative: <PRE>".htmlentities($v->serialize())."</PRE>"); |
|
86 | 86 | |
87 | 87 | output("<h3>Testing value serialization - character encoding</h3>\n"); |
88 | 88 | // The greek word 'kosme' |
89 | 89 | $v = new PhpXmlRpc\Value('κόσμε'); |
90 | -output("Greek (default encoding): <PRE>" . htmlentities($v->serialize()) . "</PRE>"); |
|
91 | -output("Greek (utf8 encoding): <PRE>" . htmlentities($v->serialize('UTF-8')) . "</PRE>"); |
|
90 | +output("Greek (default encoding): <PRE>".htmlentities($v->serialize())."</PRE>"); |
|
91 | +output("Greek (utf8 encoding): <PRE>".htmlentities($v->serialize('UTF-8'))."</PRE>"); |
|
92 | 92 | |
93 | 93 | output("<h3>Testing request serialization</h3>\n"); |
94 | 94 | $req = new PhpXmlRpc\Request('examples.getStateName'); |
95 | 95 | $req->method('examples.getStateName'); |
96 | 96 | $req->addParam(new PhpXmlRpc\Value(42, 'int')); |
97 | -output("<PRE>" . htmlentities($req->serialize()) . "</PRE>"); |
|
97 | +output("<PRE>".htmlentities($req->serialize())."</PRE>"); |
|
98 | 98 | |
99 | 99 | output("<h3>Testing response serialization</h3>\n"); |
100 | 100 | $resp = new PhpXmlRpc\Response(new PhpXmlRpc\Value('The meaning of life')); |
101 | -output("<PRE>" . htmlentities($resp->serialize()) . "</PRE>"); |
|
101 | +output("<PRE>".htmlentities($resp->serialize())."</PRE>"); |
|
102 | 102 | |
103 | 103 | output("<h3>Testing ISO date formatting</h3><pre>\n"); |
104 | 104 | $t = time(); |
105 | 105 | $date = PhpXmlRpc\Helper\Date::iso8601Encode($t); |
106 | 106 | output("Now is $t --> $date\n"); |
107 | -output("Or in UTC, that is " . PhpXmlRpc\Helper\Date::iso8601Encode($t, 1) . "\n"); |
|
107 | +output("Or in UTC, that is ".PhpXmlRpc\Helper\Date::iso8601Encode($t, 1)."\n"); |
|
108 | 108 | $tb = PhpXmlRpc\Helper\Date::iso8601Decode($date); |
109 | 109 | output("That is to say $date --> $tb\n"); |
110 | -output("Which comes out at " . PhpXmlRpc\Helper\Date::iso8601Encode($tb) . "\n"); |
|
111 | -output("Which was the time in UTC at " . PhpXmlRpc\Helper\Date::iso8601Encode($tb, 1) . "\n"); |
|
110 | +output("Which comes out at ".PhpXmlRpc\Helper\Date::iso8601Encode($tb)."\n"); |
|
111 | +output("Which was the time in UTC at ".PhpXmlRpc\Helper\Date::iso8601Encode($tb, 1)."\n"); |
|
112 | 112 | output("</pre>\n"); |
113 | 113 | |
114 | 114 | output("<h3>Testing reduced-precision formatting for doubles</h3><pre>\n"); |
115 | 115 | $v = new PhpXmlRpc\Value(1234.56789, 'double'); |
116 | 116 | \PhpXmlRpc\PhpXmlRpc::$xmlpc_double_precision = 2; |
117 | -output("Double, limited precision: <PRE>" . htmlentities($v->serialize()) . "</PRE>"); |
|
117 | +output("Double, limited precision: <PRE>".htmlentities($v->serialize())."</PRE>"); |
|
118 | 118 | |
119 | 119 | output('</body></html>'); |