Moodle

LDAP enrolment breaks due to non-defined variable used as $user property.

Details

  • Type: Bug Bug
  • Status: Closed Closed
  • Priority: Major Major
  • Resolution: Fixed
  • Affects Version/s: 1.7.2, 1.8.2, 1.9
  • Fix Version/s: 1.7.2, 1.8.2, 1.9
  • Component/s: Enrolments
  • Labels:
    None
  • Affected Branches:
    MOODLE_17_STABLE, MOODLE_18_STABLE, MOODLE_19_STABLE
  • Fixed Branches:
    MOODLE_17_STABLE, MOODLE_18_STABLE, MOODLE_19_STABLE

Description

In .../enrol/ldap/enrol.php, line 75, there is this line of code:

if ($course_obj->visible==0 && $user->{$type}[$course_obj->id] == 'ldap') {

but $type is not defined in the function scope. In fact, it's a leftover from the pre-roles enrolment code: it was used to specify the user type (student or teacher). In addition to that, the enrolments are no longer stored in $user->student or $user->teacher, so the second test condition of the sentence doesn't make sense.

Considering that all of the courses that are dealt with at that line are ldap enrolled courses, we can simply remove the second test and leave it like this:

if ($course_obj->visible==0) {

The attached patch applies cleanly to 1.7.2+, 1.8.2+ and 1.9beta as of today.

Saludos. Iñaki.

Issue Links

Activity

Hide
Petr Škoda (skodak) added a comment -

the patch is already in CVS, assigning back :-D

Show
Petr Škoda (skodak) added a comment - the patch is already in CVS, assigning back :-D

People

Vote (0)
Watch (1)

Dates

  • Created:
    Updated:
    Resolved: