From 9bcc57027a06908810be35165610175f85da9103 Mon Sep 17 00:00:00 2001
From: Aleksander Machniak <machniak@kolabsys.com>
Date: Sat, 31 Jul 2021 17:37:11 +0200
Subject: [PATCH] Fix PHP 8.1 compatibility where LDAP connection is not a
 resource, but an object

---
 lib/Net/LDAP3.php | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/lib/Net/LDAP3.php b/lib/Net/LDAP3.php
index 74224c1..384aaff 100644
--- a/lib/Net/LDAP3.php
+++ b/lib/Net/LDAP3.php
@@ -600,7 +600,7 @@ class Net_LDAP3
             return false;
         }
 
-        if (is_resource($this->conn)) {
+        if (isset($this->conn) && $this->conn !== false) {
             $this->_debug("Connection already exists");
             return true;
         }
@@ -644,7 +644,7 @@ class Net_LDAP3
             $this->_debug("S: NOT OK");
         }
 
-        if (!is_resource($this->conn)) {
+        if (!isset($this->conn) || $this->conn === false) {
             $this->_error("Could not connect to LDAP");
             return false;
         }
-- 
GitLab