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

Notice: Undefined variable: group in participants list

    XMLWordPrintable

    Details

    • Testing Instructions:
      Hide
      1. Create a course in separate groups mode, enrol a student and add him to a group, enrol a teacher without adding him to a group
      2. Log in as a student and navigate to "Participants" page
      3. Select "Teachers" from the "Current Role" drop down
        • Confirm that a PHP notice message is not displayed.
      4. Add accesssince=1 to the URL.
        • Confirm that a PHP notice message is not displayed.
      Show
      Create a course in separate groups mode, enrol a student and add him to a group, enrol a teacher without adding him to a group Log in as a student and navigate to "Participants" page Select "Teachers" from the "Current Role" drop down Confirm that a PHP notice message is not displayed. Add accesssince=1 to the URL. Confirm that a PHP notice message is not displayed.
    • Difficulty:
      Easy
    • Affected Branches:
      MOODLE_29_STABLE, MOODLE_30_STABLE
    • Fixed Branches:
      MOODLE_29_STABLE, MOODLE_30_STABLE
    • Pull Master Branch:
      MDL-52649-master

      Description

      • Create a course in separate group mode, enrol a student and add him to a group, enrol a teacher without adding him to a group
      • Log in as a student and navigate to "Participants" page
      • Select "Teachers" from the "Current Role" drop down
      • The page refreshes (expected) and produces this notice (not expected):

        Notice: Undefined variable: group in /var/web/wwwroot/moodle/user/index.php on line 513
        

      The course's instructors do not belong to any groups, so no instructors are shown, but this error also occurs after I add them to the cohorts they teach.

      I have seen this in 2.9.1 and 3.0+ but it may affect other versions.

      I have had a look in the code and it does appear that under certain circumstances the $group variable may be unset when code at line 513 attempts to read it. It appears to be set within the nested if() block starting at line 297 but is not set if the initial if() conditions are not met, leading to this notice later.

        Attachments

          Activity

            People

            Assignee:
            jpataleta Jun Pataleta
            Reporter:
            dethme0w Gerald Albion
            Peer reviewer:
            Dan Poltawski
            Integrator:
            Andrew Nicols
            Tester:
            David Monllaó
            Participants:
            Component watchers:
            Andrew Nicols, Jun Pataleta, Michael Hawkins, Shamim Rezaie, Simey Lameze, Amaia Anabitarte, Carlos Escobedo, Ferran Recio, Sara Arjona (@sarjona)
            Votes:
            0 Vote for this issue
            Watchers:
            5 Start watching this issue

              Dates

              Created:
              Updated:
              Resolved:
              Fix Release Date:
              14/Mar/16