-
Bug
-
Resolution: Fixed
-
Minor
-
3.2.5, 3.3.2, 3.4
-
MOODLE_32_STABLE, MOODLE_33_STABLE, MOODLE_34_STABLE
-
MOODLE_32_STABLE, MOODLE_33_STABLE
-
wip-
MDL-59808-master -
Short description:
webservice/rest/simpleserver.php reads moodlewsrestformat parameter and then unsets and ignores it. Therefore there is no way to set JSON encoding for REST protocol in simpleserver.php.
Long description:
At same point following code was added to both webservice/rest/simpleserver.php and webservice/rest/server.php:
$restformat = optional_param('moodlewsrestformat', 'xml', PARAM_ALPHA);
|
|
if (isset($_REQUEST['moodlewsrestformat'])) {
|
unset($_REQUEST['moodlewsrestformat']);
|
}
|
if (isset($_GET['moodlewsrestformat'])) {
|
unset($_GET['moodlewsrestformat']);
|
}
|
if (isset($_POST['moodlewsrestformat'])) {
|
unset($_POST['moodlewsrestformat']);
|
}
|
|
$server = new webservice_rest_server(WEBSERVICE_AUTHMETHOD_XXX, $restformat);
|
webservice/rest/server.php was later refactored - isset / unset lines were removed and $restformat from webservice_rest_server call - but simpleserver.php was not - the isset / unset lines are still there.
And because webservice_rest_server class checks the data retrieved from GET/POST and moodlewsrestformat is not there anymore, it will always use XML as a format.