Moodle
  1. Moodle
  2. MDL-26238

Outdated references to groups_get_group() cause unexpected behavior

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: 2.0.1
    • Fix Version/s: 2.0.2
    • Component/s: Groups
    • Labels:
    • Environment:
      N/A
    • Database:
      Any
    • Affected Branches:
      MOODLE_20_STABLE
    • Fixed Branches:
      MOODLE_20_STABLE
    • Rank:
      16301

      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

        Issue Links

          Activity

          Hide
          Petr Škoda added a comment -

          Hello, please fix your name in the git configuration - use your real name instead of "cfulton", thanks.

          Show
          Petr Škoda added a comment - Hello, please fix your name in the git configuration - use your real name instead of "cfulton", thanks.
          Hide
          Petr Škoda added a comment -

          Thanks for the report and patch!

          Show
          Petr Škoda added a comment - Thanks for the report and patch!
          Hide
          Helen Foster added a comment -

          Fix included in weekly 2.0.1+. Thanks everyone.

          Show
          Helen Foster added a comment - Fix included in weekly 2.0.1+. Thanks everyone.

            People

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

              Dates

              • Created:
                Updated:
                Resolved: