From 50943527f53e73f8dd8aa878fdebb8fafac6eb66 Mon Sep 17 00:00:00 2001
From: Thibault Dockx <thibault.dockx@fusiondirectory.org>
Date: Tue, 4 Mar 2025 18:28:03 +0000
Subject: [PATCH] :ambulance: (ldap) - fixes login issue

Fixes a wrong conditional statement.
---
 include/class_ldap.inc | 8 +-------
 1 file changed, 1 insertion(+), 7 deletions(-)

diff --git a/include/class_ldap.inc b/include/class_ldap.inc
index 5dd5bca6e..13e80573e 100755
--- a/include/class_ldap.inc
+++ b/include/class_ldap.inc
@@ -607,13 +607,7 @@ class LDAP
   function count ($srp)
   {
     if ($this->hascon) {
-      if ($this->hasres[$srp]) {
-        // Method ldap_read can return array of ldap\result (multiple ldap instances) or FALSE. We escape both.
-        // This is cleary a quick fix for php8.2 adaptation ...
-        if (is_bool($this->hasres[$srp]) || is_array($this->hasres[$srp])) {
-          logging::debug(DEBUG_LDAP, __LINE__, __FUNCTION__, __FILE__, $this->error, 'count()');
-          return FALSE;
-        }
+      if ($this->hasres[$srp] && !is_bool($this->start[$srp])) {
         $rv = @ldap_count_entries($this->cid, $this->sr[$srp]);
         $this->error = @ldap_error($this->cid);
         logging::debug(DEBUG_LDAP, __LINE__, __FUNCTION__, __FILE__, $this->error, 'count()');
-- 
GitLab