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

Outdated references to groups_get_group() cause unexpected behavior

    XMLWordPrintable

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • 2.0.1
    • 2.0.2
    • Groups
    • N/A
    • Any
    • MOODLE_20_STABLE
    • MOODLE_20_STABLE

    Description

      Prior to the major refactoring of groups in 2007 groups_get_group() took two parameters: the groupid and a boolean flag controlling whether to return the course id (see https://github.com/moodle/moodle/commit/1d68419596686b4ccac22c851d7ebdccbb379a0f#diff-2 for an example of the old code). This second parameter was removed but many hardcoded boolean references remained in the code. This wasn't a problem until 2.0+, when groups_get_group was rewritten to take three parameters: the groupid, an optional fields (default "*") passed back to the database call, and a strictness setting for the database call. All the functions which still have the hard-coded boolean second parameter are in effect calling groups_get_group and telling it not to return anything, which causes a stacktrace. The first known bug in the wild is MDL-26232 but a quick search with git grep found others.

      Four references in total; patch here: https://github.com/mackensen/moodle/commit/94f6ea5c0842f48b1633996b9632326701b78254

      Attachments

        Issue Links

          Activity

            People

              skodak Petr Skoda
              cfulton Charles Fulton
              Andrew Lyons, Huong Nguyen, Jun Pataleta, Michael Hawkins, Shamim Rezaie, Simey Lameze
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:
                21/Feb/11