diff --git a/apps/user_ldap/lib/Connection.php b/apps/user_ldap/lib/Connection.php index 208ff438d73..3bc0580be36 100644 --- a/apps/user_ldap/lib/Connection.php +++ b/apps/user_ldap/lib/Connection.php @@ -139,6 +139,9 @@ class Connection extends LDAPUtility { protected LoggerInterface $logger; private IL10N $l10n; + /** @psalm-suppress ImpureStaticProperty This is a cache for whether php-ldap is installed, which cannot change mid-process */ + private static bool $phpLDAPinstalled = true; + /** * Constructor * @param string $configPrefix a string with the prefix for the configkey column (appconfig table) @@ -589,8 +592,7 @@ class Connection extends LDAPUtility { if (!$this->configuration->ldapConfigurationActive) { return null; } - static $phpLDAPinstalled = true; - if (!$phpLDAPinstalled) { + if (!static::$phpLDAPinstalled) { return false; } if (!$this->ignoreValidation && !$this->configured) { @@ -602,7 +604,7 @@ class Connection extends LDAPUtility { } if (!$this->ldapConnectionRes) { if (!$this->ldap->areLDAPFunctionsAvailable()) { - $phpLDAPinstalled = false; + static::$phpLDAPinstalled = false; $this->logger->error( 'function ldap_connect is not available. Make sure that the PHP ldap module is installed.', ['app' => 'user_ldap']