Fix debugger for the case of a big payload with latin1 characters
[plcapi.git] / debugger / action.php
index 69f66e0..7bb07f5 100644 (file)
@@ -104,11 +104,11 @@ if ($action) {
         if (!class_exists('jsonrpc_client')) {
             die('Error: to debug the jsonrpc protocol the jsonrpc.inc file is needed');
         }
-        $clientClass = 'PhpJsRpc\client';
-        $requestClass = 'PhpJsRpc\request';
+        $clientClass = 'PhpJsRpc\Client';
+        $requestClass = 'PhpJsRpc\Request';
         $protoName = 'JSONRPC';
     } else {
-        $clientClass = 'PhpXmlRpc\client';
+        $clientClass = 'PhpXmlRpc\Client';
         $requestClass = 'PhpXmlRpc\Request';
         $protoName = 'XMLRPC';
     }
@@ -226,7 +226,7 @@ if ($action) {
                     }
                 }
             } else {
-                $msg[0]->payload = $msg[0]->xml_header() .
+                $msg[0]->payload = $msg[0]->xml_header($inputcharset) .
                     '<methodName>' . $method . "</methodName>\n<params>" .
                     $payload .
                     "</params>\n" . $msg[0]->xml_footer();
@@ -248,8 +248,7 @@ if ($action) {
         echo '<div class="dbginfo"><h2>Debug info:</h2>';
     }  /// @todo use ob_start instead
     $resp = array();
-    $mtime = explode(' ', microtime());
-    $time = (float)$mtime[0] + (float)$mtime[1];
+    $time = microtime(true);
     foreach ($msg as $message) {
         // catch errors: for older xmlrpc libs, send does not return by ref
         @$response = $client->send($message, $timeout, $httpprotocol);
@@ -258,8 +257,7 @@ if ($action) {
             break;
         }
     }
-    $mtime = explode(' ', microtime());
-    $time = (float)$mtime[0] + (float)$mtime[1] - $time;
+    $time = microtime(true) - $time;
     if ($debug) {
         echo "</div>\n";
     }