Update login-ldap.php
In some rare occasions, the ldap setup can return null when reading the $attributes[$group_indentifier]. By checking that it isn't empty before shifting the array, we prevent the following error: * array_shift expected parameter to be array, null given
This commit is contained in:
@@ -181,6 +181,10 @@ class LoginLDAPPlugin extends Plugin
|
|||||||
|
|
||||||
foreach ($groups as $group) {
|
foreach ($groups as $group) {
|
||||||
$attributes = $group->getAttributes();
|
$attributes = $group->getAttributes();
|
||||||
|
|
||||||
|
// make sure we have an array to read
|
||||||
|
if ( !empty($attributes) && !empty($attributes[$group_indentifier]) && is_array($attributes[$group_indentifier]) )
|
||||||
|
{
|
||||||
$user_group = array_shift($attributes[$group_indentifier]);
|
$user_group = array_shift($attributes[$group_indentifier]);
|
||||||
$user_groups[] = $user_group;
|
$user_groups[] = $user_group;
|
||||||
|
|
||||||
@@ -189,6 +193,7 @@ class LoginLDAPPlugin extends Plugin
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Merge the LDAP user data with Grav user
|
// Merge the LDAP user data with Grav user
|
||||||
$grav_user->merge($userdata);
|
$grav_user->merge($userdata);
|
||||||
|
|||||||
Reference in New Issue
Block a user