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

XML-RPC and SOAP error while using False as VALUE_DEFAULT

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Minor
    • Resolution: Fixed
    • Affects Version/s: 2.3.4, 2.4.1, 2.5
    • Fix Version/s: 2.3.5, 2.4.2
    • Component/s: Web Services
    • Labels:
      None
    • Testing Instructions:
      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.
    • Affected Branches:
      MOODLE_23_STABLE, MOODLE_24_STABLE, MOODLE_25_STABLE
    • Fixed Branches:
      MOODLE_23_STABLE, MOODLE_24_STABLE
    • Pull from Repository:
    • Pull Master Branch:
      MDL-37961-master

      Description

      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;
      

        Gliffy Diagrams

          Attachments

            Activity

              People

              • Votes:
                0 Vote for this issue
                Watchers:
                3 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved:
                  Fix Release Date:
                  11/Mar/13