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

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

    XMLWordPrintable

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • 1.7.2, 1.8.2, 1.9
    • 1.7.2, 1.8.2, 1.9
    • Enrolments
    • None
    • MOODLE_17_STABLE, MOODLE_18_STABLE, MOODLE_19_STABLE
    • 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.

      Attachments

        Issue Links

          Activity

            People

              iarenaza Iñaki Arenaza
              iarenaza Iñaki Arenaza
              Nobody Nobody
              David Woloszyn, Huong Nguyen, Jake Dallimore, Meirza, Michael Hawkins, Raquel Ortega, Safat Shahin, Stevani Andolo
              Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:
                30/Mar/07