Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
fix(LDAP): check index before accessing it
Signed-off-by: Arthur Schiwon <[email protected]>
  • Loading branch information
blizzz authored and backportbot[bot] committed Sep 12, 2024
commit f4990d7cd5c0f424e8d27da31e65a4bb1adb653e
7 changes: 3 additions & 4 deletions apps/user_ldap/lib/Access.php
Original file line number Diff line number Diff line change
Expand Up @@ -255,20 +255,19 @@ public function extractAttributeValuesFromResult($result, $attribute) {
* @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;
}
}
}
Expand Down