Details
-
Type:
Bug
-
Status: Closed
-
Priority:
Major
-
Resolution: Fixed
-
Affects Version/s: 2.9.1, 3.0
-
Component/s: Groups, Roles / Access
-
Testing Instructions:
-
Difficulty:Easy
-
Affected Branches:MOODLE_29_STABLE, MOODLE_30_STABLE
-
Fixed Branches:MOODLE_29_STABLE, MOODLE_30_STABLE
-
Pull from Repository:
-
Pull Master Branch:
MDL-52649-master -
Pull Master Diff URL:
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.