-
Bug
-
Resolution: Fixed
-
Major
-
1.8.2, 1.9
-
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)).'\')';