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

XML-RPC and SOAP error while using False as VALUE_DEFAULT

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: Minor Minor
    • 2.3.5, 2.4.2
    • 2.3.4, 2.4.1, 2.5
    • Web Services
    • None
    • MOODLE_23_STABLE, MOODLE_24_STABLE, MOODLE_25_STABLE
    • MOODLE_23_STABLE, MOODLE_24_STABLE
    • MDL-37961-master
    • Hide
      1. Test the web services using SOAP, XML-RPC and REST.
      2. Make sure they all work.
      3. Use a function with a default boolean parameter
        • Master: message::search_contacts()
        • 2.3, 2.4: course::delete_categories_parameters() change recursive to false first!
      4. Confirm that the default value is respected.
      Show
      Test the web services using SOAP, XML-RPC and REST. Make sure they all work. Use a function with a default boolean parameter Master: message::search_contacts() 2.3, 2.4: course::delete_categories_parameters() change recursive to false first! Confirm that the default value is respected.

      There is an eval() error when creating the definition of the functions when a webservice function uses a PARAM_BOOL as PARAM_DEFAULT, and set the default to false.

      Ie:

          public static function search_contacts_parameters() {
              return new external_function_parameters(
                  array(
                      'searchtext' => new external_value(PARAM_CLEAN, 'String the user\'s fullname has to match to be found'),
                      'onlymycourses' => new external_value(PARAM_BOOL, 'Limit search to the user\'s courses',
                          VALUE_DEFAULT, false)
                  )
              );
          }
      

      Will cause this to be generated:

      public function core_message_search_contacts($searchtext, $onlymycourses=) {
      

      The problem being here:

      # webservice/lib.php:1193
                                  case PARAM_BOOL:
                                      $paramanddefault .= '='.$keydesc->default; break;
      

            fred Frédéric Massart
            fred Frédéric Massart
            Jérôme Mouneyrac Jérôme Mouneyrac
            Eloy Lafuente (stronk7) Eloy Lafuente (stronk7)
            Rajesh Taneja Rajesh Taneja
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved:

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