fix(LDAP): do not use count() inside a loop

Signed-off-by: Arthur Schiwon <blizzz@arthur-schiwon.de>
This commit is contained in:
Arthur Schiwon 2026-03-18 10:55:22 +01:00 committed by backportbot[bot]
parent d70f67e93d
commit b10d1b5c02

View file

@ -129,7 +129,8 @@ class User {
$attr = strtolower($this->connection->ldapEmailAttribute);
if (isset($ldapEntry[$attr])) {
$mailValue = 0;
for ($x = 0; $x < count($ldapEntry[$attr]); $x++) {
$emailValues = count($ldapEntry[$attr]);
for ($x = 0; $x < $emailValues; $x++) {
if (filter_var($ldapEntry[$attr][$x], FILTER_VALIDATE_EMAIL)) {
$mailValue = $x;
break;