diff --git a/include/class_ldap.inc b/include/class_ldap.inc
index 5dd5bca6e1be5cc3303bf064d939c23e0d321b90..13e80573e4b8d57712c326ac97b50710ee14b987 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()');