diff --git a/apps/user_ldap/lib/Access.php b/apps/user_ldap/lib/Access.php index b693c693c92..8b82b607774 100644 --- a/apps/user_ldap/lib/Access.php +++ b/apps/user_ldap/lib/Access.php @@ -49,6 +49,7 @@ class Access extends LDAPUtility { protected $groupMapper; private string $lastCookie = ''; + private array $intermediates = []; public function __construct( ILDAPWrapper $ldap, @@ -484,8 +485,7 @@ class Access extends LDAPUtility { * @throws \Exception */ public function dn2ocname($fdn, $ldapName = null, $isUser = true, &$newlyMapped = null, ?array $record = null, bool $autoMapping = true) { - static $intermediates = []; - if (isset($intermediates[($isUser ? 'user-' : 'group-') . $fdn])) { + if (isset($this->intermediates[($isUser ? 'user-' : 'group-') . $fdn])) { return false; // is a known intermediate } @@ -532,7 +532,7 @@ class Access extends LDAPUtility { $record = $this->readAttributes($fdn, $attributesToRead, $filter); if ($record === false) { $this->logger->debug('Cannot read attributes for ' . $fdn . '. Skipping.', ['filter' => $filter]); - $intermediates[($isUser ? 'user-' : 'group-') . $fdn] = true; + $this->intermediates[($isUser ? 'user-' : 'group-') . $fdn] = true; return false; } } @@ -579,7 +579,7 @@ class Access extends LDAPUtility { $ldapName = $record[$nameAttribute]; if (!isset($ldapName[0]) || empty($ldapName[0])) { $this->logger->debug('No or empty name for ' . $fdn . ' with filter ' . $filter . '.', ['app' => 'user_ldap']); - $intermediates['group-' . $fdn] = true; + $this->intermediates['group-' . $fdn] = true; return false; } $ldapName = $ldapName[0];