Commit e4d9c24f authored by Richard Mansfield's avatar Richard Mansfield
Browse files

Fix warning when trying to sanitise missing ldap fields (bug #888840)

During "update user info on login", we were attempting to sanitise all
ldap attributes in the config, even when they are not set (commit
46189cc1).  This generates php warnings, which have become more
obvious now that Display Name and Student ID have been added to the
list of attributes (see commit 35d2f822


Change-Id: I015855b956f0fcfa71db087ad1dfebffffd09396
Signed-off-by: default avatarRichard Mansfield <>
parent e5430524
......@@ -136,6 +136,9 @@ class AuthLdap extends Auth {
// Match database and ldap entries and update in database if required
$fieldstoimport = array_keys($ldapattributes);
foreach ($fieldstoimport as $field) {
if (!isset($ldapdetails[$field])) {
$sanitizer = "sanitize_$field";
$ldapdetails[$field] = $sanitizer($ldapdetails[$field]);
if (!empty($ldapdetails[$field]) && ($user->$field != $ldapdetails[$field])) {
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment