fix(LDAP): check index before accessing it

Signed-off-by: Arthur Schiwon <blizzz@arthur-schiwon.de>
pull/47914/head
Arthur Schiwon 8 months ago
parent 8feef45506
commit c8fc2e8a67
No known key found for this signature in database
GPG Key ID: 7424F1874854DF23
  1. 7
      apps/user_ldap/lib/Access.php

@ -305,20 +305,19 @@ class Access extends LDAPUtility {
* @return array If a range was detected with keys 'values', 'attributeName',
* 'attributeFull' and 'rangeHigh', otherwise empty.
*/
public function extractRangeData($result, $attribute) {
public function extractRangeData(array $result, string $attribute): array {
$keys = array_keys($result);
foreach ($keys as $key) {
if ($key !== $attribute && str_starts_with((string)$key, $attribute)) {
$queryData = explode(';', (string)$key);
if (str_starts_with($queryData[1], 'range=')) {
if (isset($queryData[1]) && str_starts_with($queryData[1], 'range=')) {
$high = substr($queryData[1], 1 + strpos($queryData[1], '-'));
$data = [
return [
'values' => $result[$key],
'attributeName' => $queryData[0],
'attributeFull' => $key,
'rangeHigh' => $high,
];
return $data;
}
}
}

Loading…
Cancel
Save