From: skodak Date: Fri, 23 Oct 2009 00:09:22 +0000 (+0000) Subject: MDL-12886 fixed strict type checking of paramters in XML-RPC client X-Git-Url: http://git.mjollnir.org/gw?a=commitdiff_plain;h=b9b3a3e7cd6be2c9420dbec8ebe39f1412001b28;p=moodle.git MDL-12886 fixed strict type checking of paramters in XML-RPC client --- diff --git a/webservice/testclient.php b/webservice/testclient.php index 56c5b7f32a..6035ce43ee 100644 --- a/webservice/testclient.php +++ b/webservice/testclient.php @@ -24,6 +24,7 @@ */ require('../config.php'); +require_once("$CFG->libdir/externallib.php"); require_once("$CFG->dirroot/webservice/testclient_forms.php"); $function = optional_param('function', '', PARAM_SAFEDIR); @@ -75,6 +76,9 @@ if ($mform->is_cancelled()) { redirect('testclient.php'); } else if ($data = $mform->get_data()) { + + $functioninfo = external_function_info($function); + // remove unused from form data unset($data->submitbutton); unset($data->protocol); @@ -117,6 +121,9 @@ if ($mform->is_cancelled()) { throw new coding_exception('Testing of function '.$function.' not implemented yet!'); } + // now test the parameters, this also fixes PHP data types + $params = external_api::validate_parameters($functioninfo->parameters_desc, $params); + echo $OUTPUT->header(); echo $OUTPUT->heading(get_string('pluginname', 'webservice_'.$protocol).': '.$function);