Skip to content

Commit e46541b

Browse files
committed
fix(LDAP): check index before accessing it
Signed-off-by: Arthur Schiwon <blizzz@arthur-schiwon.de>
1 parent 8feef45 commit e46541b

File tree

1 file changed

+3
-4
lines changed

1 file changed

+3
-4
lines changed

apps/user_ldap/lib/Access.php

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -305,20 +305,19 @@ public function extractAttributeValuesFromResult($result, $attribute) {
305305
* @return array If a range was detected with keys 'values', 'attributeName',
306306
* 'attributeFull' and 'rangeHigh', otherwise empty.
307307
*/
308-
public function extractRangeData($result, $attribute) {
308+
public function extractRangeData(array $result, string $attribute): array {
309309
$keys = array_keys($result);
310310
foreach ($keys as $key) {
311311
if ($key !== $attribute && str_starts_with((string)$key, $attribute)) {
312312
$queryData = explode(';', (string)$key);
313-
if (str_starts_with($queryData[1], 'range=')) {
313+
if ($queryData && isset($queryData[1]) && str_starts_with($queryData[1], 'range=')) {
314314
$high = substr($queryData[1], 1 + strpos($queryData[1], '-'));
315-
$data = [
315+
return [
316316
'values' => $result[$key],
317317
'attributeName' => $queryData[0],
318318
'attributeFull' => $key,
319319
'rangeHigh' => $high,
320320
];
321-
return $data;
322321
}
323322
}
324323
}

0 commit comments

Comments
 (0)