Uploaded image for project: 'Moodle'
  1. Moodle
  2. MDL-22969

REST protocol doesn't handle empty array (client to server way)

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Deferred
    • Icon: Minor Minor
    • None
    • 2.0, Future Dev
    • Web Services
    • MOODLE_20_STABLE

      Empty array aren't send to the REST server, find a way to send them.

      The following description will break because no $options array is recieved by the REST server (the REST client didn't send empty array):

      /**
           * Returns description of method parameters
           * @return external_function_parameters
           */
          public static function get_courses_parameters() {
              return new external_function_parameters(
                                  array(
                                          'search' => new external_value(PARAM_TEXT, 'string to search'),
                                          'downloadable' => new external_value(PARAM_BOOL, 'course can be downloadable'),
                                          'enrollable' => new external_value(PARAM_BOOL, 'course can be enrollable'),
                                          'options' => new external_single_structure(
                                              array(
                                                      'ids' => new external_multiple_structure(new external_value(PARAM_INTEGER, 'id of a course in the hub course directory'), 'ids of course', VALUE_OPTIONAL),
                                                      'sitecourseids' => new external_multiple_structure(new external_value(PARAM_INTEGER, 'id of a course in the site'), 'ids of course in the site', VALUE_OPTIONAL),
                                                      'coverage' => new external_value(PARAM_TEXT, 'coverage', VALUE_OPTIONAL),
                                                      'licenceshortname' => new external_value(PARAM_ALPHANUMEXT, 'licence short name', VALUE_OPTIONAL),
                                                      'subject' => new external_value(PARAM_ALPHANUM, 'subject', VALUE_OPTIONAL),
                                                      'audience' => new external_value(PARAM_ALPHA, 'audience', VALUE_OPTIONAL),
                                                      'educationallevel' => new external_value(PARAM_ALPHA, 'educational level', VALUE_OPTIONAL),
                                                      'language' => new external_value(PARAM_ALPHANUMEXT, 'language', VALUE_OPTIONAL),
                                                      'allsitecourses' => new external_value(PARAM_INTEGER,
                                                              'if 1 return all not visible and visible courses whose siteid is the site
                                                                  matching token. And course of this site only. In case of public token access, this param option is ignored', VALUE_DEFAULT, 0),
                                              ), 'course info')
                      )
              );
          }

            jerome Jérôme Mouneyrac
            jerome Jérôme Mouneyrac
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved:

                Error rendering 'clockify-timesheets-time-tracking-reports:timer-sidebar'. Please contact your Jira administrators.