From 909850a4945fb9f37c8005a31f501861df9b3942 Mon Sep 17 00:00:00 2001 From: Dan Winship Date: Mon, 6 Aug 2012 14:28:00 -0400 Subject: soup-xmlrpc: fix parsing of without If a method takes no parameters, you can leave out the section of , but soup_xmlrpc_parse_method_call() was requiring it anyway. Fix that and add some tests of parameter-less methods. https://bugzilla.gnome.org/show_bug.cgi?id=671661 --- tests/xmlrpc-server.php | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) (limited to 'tests/xmlrpc-server.php') diff --git a/tests/xmlrpc-server.php b/tests/xmlrpc-server.php index 2e3dd381..66cb2be7 100644 --- a/tests/xmlrpc-server.php +++ b/tests/xmlrpc-server.php @@ -2,13 +2,13 @@ function paramfault () { - # xmlrpc-epi-php translates this into a real + # xmlrpc-php translates this into a real $fault["faultCode"] = -32602; $fault["faultString"] = "bad parameter"; return $fault; } -# We only check the params in sum(), because that's the one that +# We only check the params in sum(), because that is the one that # xmlrpc-test tests will fail if given bad args function sum ($method_name, $params, $app_data) @@ -69,8 +69,16 @@ function echo_ ($method_name, $params, $app_data) return $params[0]; } -# Work around xmlrpc-epi-php lossage; otherwise the datetime values -# we return will sometimes get a DST adjustment we don't want. +function ping ($method_name, $params, $app_data) +{ + if (count ($params) == 0) + return "pong"; + else + return paramfault (); +} + +# Work around xmlrpc-php lossage; otherwise the datetime values +# we return will sometimes get a DST adjustment we do not want. putenv ("TZ="); $xmlrpc_server = xmlrpc_server_create (); @@ -79,6 +87,7 @@ xmlrpc_server_register_method($xmlrpc_server, "countBools", "countBools"); xmlrpc_server_register_method($xmlrpc_server, "md5sum", "md5sum"); xmlrpc_server_register_method($xmlrpc_server, "dateChange", "dateChange"); xmlrpc_server_register_method($xmlrpc_server, "echo", "echo_"); +xmlrpc_server_register_method($xmlrpc_server, "ping", "ping"); $response = xmlrpc_server_call_method ($xmlrpc_server, implode("\r\n", file('php://input')), -- cgit v1.2.1