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

Apostrophes preventing any users in course being unenrolled via LDAP

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: Major Major
    • 1.8.6, 1.9.2
    • 1.8.2, 1.9
    • Enrolments
    • None
    • MS Active Directory
    • MySQL
    • MOODLE_18_STABLE, MOODLE_19_STABLE
    • MOODLE_18_STABLE, MOODLE_19_STABLE

      If any member of a course has an ID number containing an apostrophe (eg. CN=Paddy O'Brien,OU=Students,DC=etc...), no other members will ever be unenrolled via LDAP.

      In enrol/ldap/enrol.php, this is due to the array $ldapmembers not accounting for apostrophes and therefore get_records_sql($sql) fails to return any members due to the resultant syntax error.

      It doesn't just affect the name with an apostrophe - it affects any members of the same course.

      We fixed by replacing the following code around line 264 (v1.8.2)

      $sql .= 'AND usr.idnumber NOT IN (\''. join('\',\'', $ldapmembers).'\')';

      with...

      $sql .= 'AND usr.idnumber NOT IN (\''. join('\',\'', str_replace("'", "\'",$ldapmembers)).'\')';

            iarenaza Iñaki Arenaza
            mcwoods Michael Woods
            Votes:
            1 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved:

                Error rendering 'clockify-timesheets-time-tracking-reports:timer-sidebar'. Please contact your Jira administrators.