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

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

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: 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.

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              iarenaza Iñaki Arenaza
              Reporter:
              iarenaza Iñaki Arenaza
              Tester:
              Nobody
              Participants:
              Component watchers:
              Amaia Anabitarte, Carlos Escobedo, Ferran Recio, Sara Arjona (@sarjona), Víctor Déniz Falcón
              Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved:
                Fix Release Date:
                30/Mar/07