* fixed: the debugger would fail sending a request with ISO-8859-1 payload (it missed the character set declaration).
It would have a hard time coping with ISO-8859-1 in other fields, such as e.g. the remote method name
+* fixed: the debugger would generate a bad payload via the 'load method synopsis' button for signatures containing NULLs
+
+* fixed: the debugger would generate a bad payload via the 'load method synopsis' button for methods with multiple
+ signatures
+
* improved: the debugger is displayed using UTF-8, making it more useful to debug any kind of service
* improved: echo all debug messages even when there are characters in them which php deems to be in a wrong encoding;
$desc = "-";
}
echo "<tr><td class=\"evenrow\">Description</td><td colspan=\"3\" class=\"evenrow\">$desc</td></tr>\n";
- $payload = "";
- $alt_payload = "";
+
if ($r2->kindOf() != "array") {
echo "<tr><td class=\"oddrow\">Signature</td><td class=\"oddrow\">Unknown</td><td class=\"oddrow\"> </td></tr>\n";
} else {
for ($i = 0; $i < $r2->arraysize(); $i++) {
+ $payload = "";
+ $alt_payload = "";
if ($i + 1 % 2) {
$class = ' class="oddrow"';
} else {
$y = $x->arraymem($k);
echo htmlspecialchars($y->scalarval(), ENT_COMPAT, \PhpXmlRpc\PhpXmlRpc::$xmlrpc_internalencoding);
if ($wstype != 1) {
+ $type = $y->scalarval();
+ if ($type == 'null') {
+ $type = 'nil';
+ }
$payload = $payload . '<param><value><' .
- htmlspecialchars($y->scalarval(), ENT_COMPAT, \PhpXmlRpc\PhpXmlRpc::$xmlrpc_internalencoding) .
- '></' . htmlspecialchars($y->scalarval(), ENT_COMPAT, \PhpXmlRpc\PhpXmlRpc::$xmlrpc_internalencoding) .
+ htmlspecialchars($type, ENT_COMPAT, \PhpXmlRpc\PhpXmlRpc::$xmlrpc_internalencoding) .
+ '></' . htmlspecialchars($type, ENT_COMPAT, \PhpXmlRpc\PhpXmlRpc::$xmlrpc_internalencoding) .
"></value></param>\n";
}
$alt_payload .= $y->scalarval();
$returnObj_sig = $wrapper->wrapPhpFunction(array($c, 'returnObject'), '', array('encode_php_objs' => true));
+// used to test signatures with NULL params
+$findstate12_sig = array(
+ array(Value::$xmlrpcString, Value::$xmlrpcInt, Value::$xmlrpcNull),
+ array(Value::$xmlrpcString, Value::$xmlrpcNull, Value::$xmlrpcInt),
+);
+
+function findStateWithNulls($req)
+{
+ $a = $req->getParam(0);
+ $b = $req->getParam(1);
+
+ if ($a->scalartyp() == Value::$xmlrpcNull)
+ return new PhpXmlRpc\Response(new Value(inner_findstate($b->scalarval())));
+ else
+ return new PhpXmlRpc\Response(new Value(inner_findstate($a->scalarval())));
+}
+
$addtwo_sig = array(array(Value::$xmlrpcInt, Value::$xmlrpcInt, Value::$xmlrpcInt));
$addtwo_doc = 'Add two integers together and return the result';
function addTwo($req)
'tests.getStateName.10' => $findstate10_sig,
'tests.getStateName.11' => $findstate11_sig,
+ 'tests.getStateName.12' => array(
+ "function" => "findStateWithNulls",
+ "signature" => $findstate12_sig,
+ "docstring" => $findstate_doc,
+ ),
+
'tests.returnPhpObject' => $returnObj_sig,
);
$signatures = array_merge($signatures, $moreSignatures);
+// enable support for the NULL extension
+PhpXmlRpc\PhpXmlRpc::$xmlrpc_null_extension = true;
+
$s = new PhpXmlRpc\Server($signatures, false);
$s->setdebug(3);
$s->compress_response = true;
}
}
+ /**
+ * @param PhpXmlRpc\Request|array $msg
+ * @param int|array $errorCode
+ * @param bool $returnResponse
+ * @return mixed|\PhpXmlRpc\Response|\PhpXmlRpc\Response[]|\PhpXmlRpc\Value|string|void
+ */
protected function send($msg, $errorCode = 0, $returnResponse = false)
{
if ($this->collectCodeCoverageInformation) {
$v = $this->send($f);
}
+ public function testNullParams()
+ {
+ $f = new xmlrpcmsg('tests.getStateName.12', array(
+ new xmlrpcval('whatever', 'null'),
+ new xmlrpcval(23, 'int'),
+ ));
+ $v = $this->send($f);
+ if ($v) {
+ $this->assertEquals('Michigan', $v->scalarval());
+ }
+ $f = new xmlrpcmsg('tests.getStateName.12', array(
+ new xmlrpcval(23, 'int'),
+ new xmlrpcval('whatever', 'null'),
+ ));
+ $v = $this->send($f);
+ if ($v) {
+ $this->assertEquals('Michigan', $v->scalarval());
+ }
+ $f = new xmlrpcmsg('tests.getStateName.12', array(
+ new xmlrpcval(23, 'int')
+ ));
+ $v = $this->send($f, array($GLOBALS['xmlrpcerr']['incorrect_params']));
+ }
+
public function testCodeInjectionServerSide()
{
$f = new xmlrpcmsg('system.MethodHelp');