MDL-24666 sync_users.php can throw db exception on sites upgraded from 1.x
commit971db6a11057c18227c50c5e7044ebcfd3473ce5
authorIñaki Arenaza <iarenaza@mondragon.edu>
Mon, 4 Jul 2011 19:38:53 +0000 (4 21:38 +0200)
committerIñaki Arenaza <iarenaza@mondragon.edu>
Mon, 4 Jul 2011 19:47:43 +0000 (4 21:47 +0200)
tree30ffd66994f6013f62b3983165e0b128db39739d
parent81f8e0f8a003d6954fa59e76fb50dbc96ff6a3fc
MDL-24666 sync_users.php can throw db exception on sites upgraded from 1.x

From 2.0 on we lowercase all the settings related to LDAP attributes
to cope with differences in LDAP servers when returning attribute
names as array indices (some lowercase them, some leave them as
specified in the query, some normalize them, etc.).

But we only lowercase them when saving the settings page. So on sites
that have been migrated from 1.x, it may happen that we still have
mixed-case attribute names. And this is fatal for the user_attribute
setting, as we might not detect it in the returned array from LDAP and
it will be empty (and the db layer throws and exception).

So we just make sure the attribute name is lowercased (and trimmed,
in case it's got some white space around it).

Signed-off-by: Iñaki Arenaza <iarenaza@mondragon.edu>
auth/ldap/auth.php