Fix debugger for the case of a big payload with latin1 characters
[plcapi.git] / debugger / action.php
index f77c876..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";
     }
@@ -502,7 +500,7 @@ if ($action) {
     // no action taken yet: give some instructions on debugger usage
     ?>
 
-    <h3>Instructions on usage of the debugger:</h3>
+    <h3>Instructions on usage of the debugger</h3>
     <ol>
         <li>Run a 'list available methods' action against desired server</li>
         <li>If list of methods appears, click on 'describe method' for desired method</li>
@@ -516,13 +514,13 @@ if ($action) {
     }
     ?>
 
-    <h3>Example:</h3>
+    <h3>Example</h3>
     <p>
         Server Address: phpxmlrpc.sourceforge.net<br/>
         Path: /server.php
     </p>
 
-    <h3>Notice:</h3>
+    <h3>Notice</h3>
     <p>all usernames and passwords entered on the above form will be written to the web server logs of this server. Use
         with care.</p>