From 68f417b3542803541d246fa9ef9b0fd98dd44522 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=B4me=20Chilliet?= Date: Mon, 11 May 2026 18:44:26 +0200 Subject: [PATCH] chore(user_ldap): Move static var to static property and silence warning MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Côme Chilliet --- apps/user_ldap/lib/Connection.php | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) 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']