mirror of
https://github.com/nextcloud/server.git
synced 2026-04-28 17:48:40 -04:00
Merge pull request #47919 from nextcloud/backport/47914/stable30
[stable30] fix(LDAP): check index before accessing it
This commit is contained in:
commit
9561834b96
1 changed files with 3 additions and 4 deletions
|
|
@ -255,20 +255,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…
Reference in a new issue