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

notes externallib functions: validate_parameters() second parameter is not well formatted

    XMLWordPrintable

    Details

    • Testing Instructions:
      Hide

      Requirements

      1. A ws setup.
      2. A ws client of your choice. You can use https://github.com/ankitagarwal/moodle-ws-client/blob/master/client.php if you like.

      Test

      1. Create a few notes. (You can do this by visiting any user profile in a course). Add notes in all different contexts (Site, personal, course)
      2. Update your ws script to call function "core_notes_get_notes" and params as an array of note ids

        $params['notes'] = array(1,2,3); // If using REST
        $params = array(array(1,2,3)); // for xml-rpc
        

      3. Make the ws call, make sure you get the note details in response and not an invalid param error.
      4. Repeat this with core_notes_delete_notes (The response for delete calls are empty xml structure)
      Show
      Requirements A ws setup. A ws client of your choice. You can use https://github.com/ankitagarwal/moodle-ws-client/blob/master/client.php if you like. Test Create a few notes. (You can do this by visiting any user profile in a course). Add notes in all different contexts (Site, personal, course) Update your ws script to call function "core_notes_get_notes" and params as an array of note ids $params['notes'] = array(1,2,3); // If using REST $params = array(array(1,2,3)); // for xml-rpc Make the ws call, make sure you get the note details in response and not an invalid param error. Repeat this with core_notes_delete_notes (The response for delete calls are empty xml structure)
    • Affected Branches:
      MOODLE_25_STABLE, MOODLE_27_STABLE, MOODLE_28_STABLE
    • Fixed Branches:
      MOODLE_27_STABLE, MOODLE_28_STABLE
    • Pull Master Branch:
      MDL-41026-master

      Description

      https://tracker.moodle.org/browse/MDL-30072?focusedCommentId=228182&page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#comment-228182

      Hi,
      I have issues with the delete_notes WS functions...

      After a review of the notes/externallib.php code review, a fix could be, on line 229:
      $params = self::validate_parameters(self::delete_notes_parameters(), array('notes' => $notes));
      Instead of:
      $params = self::validate_parameters(self::delete_notes_parameters(), $notes);
      The errors I have with the WS function are:
      Calling parameters do not match signature
      (If I incorporate the 'notes' index that is missing) Or
      Missing required key in single structure: notes
      (If I do not incorporate it...)
      As I have tested all the combinations possible for the WS function parameter, I hope it is not a misunderstanding on my side...

        Attachments

          Activity

            People

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

              Dates

              • Created:
                Updated:
                Resolved:
                Fix Release Date:
                2/Feb/15