X-Git-Url: http://git.onelab.eu/?a=blobdiff_plain;f=debugger%2Faction.php;h=3e22c692ad1085c680fadf78eeb50518e22e43c8;hb=99530b7cb64e5ddc9be8036acae49eff38f1e278;hp=69f66e0c26f88fa53388a9a0bd1a616ea084f5f1;hpb=8e7f7c3cd2daa0c63b3b54b83caad271e1feb31c;p=plcapi.git diff --git a/debugger/action.php b/debugger/action.php index 69f66e0..3e22c69 100644 --- a/debugger/action.php +++ b/debugger/action.php @@ -8,6 +8,9 @@ * @todo use ob_start to catch debug info and echo it AFTER method call results? * @todo be smarter in creating client stub for proxy/auth cases: only set appropriate property of client obj **/ + +header('Content-Type: text/html; charset=utf-8'); + ?> @@ -104,11 +107,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 +229,7 @@ if ($action) { } } } else { - $msg[0]->payload = $msg[0]->xml_header() . + $msg[0]->payload = $msg[0]->xml_header($inputcharset) . '' . $method . "\n" . $payload . "\n" . $msg[0]->xml_footer(); @@ -239,7 +242,7 @@ if ($action) { // Before calling execute, echo out brief description of action taken + date and time ??? // this gives good user feedback for long-running methods... - echo '

' . htmlspecialchars($actionname) . ' on server ' . htmlspecialchars($server) . " ...

\n"; + echo '

' . htmlspecialchars($actionname, ENT_COMPAT, $inputcharset) . ' on server ' . htmlspecialchars($server, ENT_COMPAT, $inputcharset) . " ...

\n"; flush(); $response = null; @@ -248,8 +251,7 @@ if ($action) { echo '

Debug info:

'; } /// @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 +260,7 @@ if ($action) { break; } } - $mtime = explode(' ', microtime()); - $time = (float)$mtime[0] + (float)$mtime[1] - $time; + $time = microtime(true) - $time; if ($debug) { echo "
\n"; } @@ -267,14 +268,14 @@ if ($action) { if ($response) { if ($response->faultCode()) { // call failed! echo out error msg! - //echo '

'.htmlspecialchars($actionname).' on server '.htmlspecialchars($server).'

'; + //echo '

'.htmlspecialchars($actionname, ENT_COMPAT, $inputcharset).' on server '.htmlspecialchars($server, ENT_COMPAT, $inputcharset).'

'; echo "

$protoName call FAILED!

\n"; - echo "

Fault code: [" . htmlspecialchars($response->faultCode()) . - "] Reason: '" . htmlspecialchars($response->faultString()) . "'

\n"; + echo "

Fault code: [" . htmlspecialchars($response->faultCode(), ENT_COMPAT, \PhpXmlRpc\PhpXmlRpc::$xmlrpc_internalencoding) . + "] Reason: '" . htmlspecialchars($response->faultString(), ENT_COMPAT, \PhpXmlRpc\PhpXmlRpc::$xmlrpc_internalencoding) . "'

\n"; echo(strftime("%d/%b/%Y:%H:%M:%S\n")); } else { // call succeeded: parse results - //echo '

'.htmlspecialchars($actionname).' on server '.htmlspecialchars($server).'

'; + //echo '

'.htmlspecialchars($actionname, ENT_COMPAT, $inputcharset).' on server '.htmlspecialchars($server, ENT_COMPAT, $inputcharset).'

'; printf("

%s call(s) OK (%.2f secs.)

\n", $protoName, $time); echo(strftime("%d/%b/%Y:%H:%M:%S\n")); @@ -293,27 +294,27 @@ if ($action) { } else { $class = ' class="evenrow"'; } - echo("" . htmlspecialchars($rec->scalarval()) . "
" . - "" . - "" . - "" . - "" . + echo("" . htmlspecialchars($rec->scalarval(), ENT_COMPAT, \PhpXmlRpc\PhpXmlRpc::$xmlrpc_internalencoding) . "" . + "" . + "" . + "" . + "" . "" . - "" . - "" . + "" . + "" . "" . "" . "" . - "" . - "" . - "" . - "" . + "" . + "" . + "" . + "" . "" . "" . - "" . + "" . "" . - "" . - "scalarval() . "\" />" . + "" . + "scalarval(), ENT_COMPAT, \PhpXmlRpc\PhpXmlRpc::$xmlrpc_internalencoding) . "\" />" . "" . "" . "" . @@ -343,8 +344,8 @@ if ($action) { $r2 = $resp[1]->value(); echo "\n"; - echo "\n\n\n\n"; - $desc = htmlspecialchars($r1->scalarval()); + echo "\n\n\n\n"; + $desc = htmlspecialchars($r1->scalarval(), ENT_COMPAT, \PhpXmlRpc\PhpXmlRpc::$xmlrpc_internalencoding); if ($desc == "") { $desc = "-"; } @@ -364,13 +365,16 @@ if ($action) { $x = $r2->arraymem($i); if ($x->kindOf() == "array") { $ret = $x->arraymem(0); - echo "OUT: " . htmlspecialchars($ret->scalarval()) . "
IN: ("; + echo "OUT: " . htmlspecialchars($ret->scalarval(), ENT_COMPAT, \PhpXmlRpc\PhpXmlRpc::$xmlrpc_internalencoding) . "
IN: ("; if ($x->arraysize() > 1) { for ($k = 1; $k < $x->arraysize(); $k++) { $y = $x->arraymem($k); - echo $y->scalarval(); + echo htmlspecialchars($y->scalarval(), ENT_COMPAT, \PhpXmlRpc\PhpXmlRpc::$xmlrpc_internalencoding); if ($wstype != 1) { - $payload = $payload . '<' . htmlspecialchars($y->scalarval()) . '>scalarval()) . ">\n"; + $payload = $payload . '<' . + htmlspecialchars($y->scalarval(), ENT_COMPAT, \PhpXmlRpc\PhpXmlRpc::$xmlrpc_internalencoding) . + '>scalarval(), ENT_COMPAT, \PhpXmlRpc\PhpXmlRpc::$xmlrpc_internalencoding) . + ">\n"; } $alt_payload .= $y->scalarval(); if ($k < $x->arraysize() - 1) { @@ -387,28 +391,28 @@ if ($action) { // button to test this method //$payload="\n$method\n\n$payload\n"; echo "" . - "" . - "" . - "" . - "" . + "" . + "" . + "" . + "" . "" . - "" . - "" . + "" . + "" . "" . "" . "" . - "" . - "" . - "" . - "" . + "" . + "" . + "" . + "" . "" . "" . - "" . + "" . "" . - "" . - "" . - "" . - "" . + "" . + "" . + "" . + "" . "" . ""; if ($wstype != 1) { @@ -417,29 +421,29 @@ if ($action) { echo "\n"; echo "
" . - "" . - "" . - "" . - "" . + "" . + "" . + "" . + "" . "" . - "" . - "" . + "" . + "" . "" . "" . "" . - "" . - "" . - "" . - "" . + "" . + "" . + "" . + "" . "" . "" . - "" . + "" . "" . - "" . - "" . + "" . + "" . "" . - "" . - "" . + "" . + "" . "" . "" . "" . @@ -528,6 +532,7 @@ if ($action) {

Changelog

    +
  • 2015-04-19: fix problems with LATIN-1 characters in payload
  • 2007-02-20: add visual editor for method payload; allow strings, bools as jsonrpc msg id
  • 2006-06-26: support building php code stub for calling remote methods
  • 2006-05-25: better support for long running queries; check for no-curl installs
Method" . htmlspecialchars($method) . "  
Method" . htmlspecialchars($method, ENT_COMPAT, $inputcharset) . "