]> git.mjollnir.org Git - moodle.git/commitdiff
MDL-12886 fixed strict type checking of paramters in XML-RPC client
authorskodak <skodak>
Fri, 23 Oct 2009 00:09:22 +0000 (00:09 +0000)
committerskodak <skodak>
Fri, 23 Oct 2009 00:09:22 +0000 (00:09 +0000)
webservice/testclient.php

index 56c5b7f32a97be77765bba075dc110fdf150b8f7..6035ce43ee84641bd21f770f5f89a89c166811fd 100644 (file)
@@ -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);