MDL-12886 fixed strict type checking of paramters in XML-RPC client

This commit is contained in:
skodak 2009-10-23 00:09:22 +00:00
parent c7e8e6b72b
commit b9b3a3e7cd

View file

@ -24,6 +24,7 @@
*/ */
require('../config.php'); require('../config.php');
require_once("$CFG->libdir/externallib.php");
require_once("$CFG->dirroot/webservice/testclient_forms.php"); require_once("$CFG->dirroot/webservice/testclient_forms.php");
$function = optional_param('function', '', PARAM_SAFEDIR); $function = optional_param('function', '', PARAM_SAFEDIR);
@ -75,6 +76,9 @@ if ($mform->is_cancelled()) {
redirect('testclient.php'); redirect('testclient.php');
} else if ($data = $mform->get_data()) { } else if ($data = $mform->get_data()) {
$functioninfo = external_function_info($function);
// remove unused from form data // remove unused from form data
unset($data->submitbutton); unset($data->submitbutton);
unset($data->protocol); unset($data->protocol);
@ -117,6 +121,9 @@ if ($mform->is_cancelled()) {
throw new coding_exception('Testing of function '.$function.' not implemented yet!'); 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->header();
echo $OUTPUT->heading(get_string('pluginname', 'webservice_'.$protocol).': '.$function); echo $OUTPUT->heading(get_string('pluginname', 'webservice_'.$protocol).': '.$function);