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

get_data() in lib/completionlib.php called with wrong number of parameters

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Minor
    • Resolution: Fixed
    • Affects Version/s: 2.2.4, 2.3.1, 2.4
    • Fix Version/s: 2.2.5, 2.3.2
    • Component/s: Libraries
    • Labels:
    • Testing Instructions:
      Hide

      Enable completion in Advanced features
      Create a new course with Completion enabled
      Create a forum in the course, and enable "Students can manually mark this activity as completed"
      Create and enroll a user in the course
      Login as user, click checkbox beside forum to mark as complete
      Reload page and check the checkbox remains checked and no errors have occured

      Show
      Enable completion in Advanced features Create a new course with Completion enabled Create a forum in the course, and enable "Students can manually mark this activity as completed" Create and enroll a user in the course Login as user, click checkbox beside forum to mark as complete Reload page and check the checkbox remains checked and no errors have occured
    • Affected Branches:
      MOODLE_22_STABLE, MOODLE_23_STABLE, MOODLE_24_STABLE
    • Fixed Branches:
      MOODLE_22_STABLE, MOODLE_23_STABLE
    • Pull Master Branch:

      Description

      In library lib/completionlib.php function set_module_viewed() calls get_data() on line 621 like this:

      $data = $this->get_data($cm, $userid);

      But the get_data function (same file) argument list is like this:

      public function get_data($cm, $wholecourse=false, $userid=0, $modinfo=null)

      {...}

      So it takes another argument before $userid! So I think we need to call the function like so:

      $data = $this->get_data($cm, false, $userid);

      This creates no problems if we are setting module viewed for $USER, and thus $userid is null.
      But if in some script or otherwise programatically we want to set module viewed for a specific user with a specific $userid, we will have a problem.

        Gliffy Diagrams

          Attachments

            Activity

              People

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

                Dates

                • Created:
                  Updated:
                  Resolved:
                  Fix Release Date:
                  10/Sep/12