diff --git a/include/class_config.inc b/include/class_config.inc
index 2b1bedbc6337dcb1b98fdcf4484298f404365f86..9318e13cbcb193602f2b2cbcb41586ee77cc3827 100644
--- a/include/class_config.inc
+++ b/include/class_config.inc
@@ -308,7 +308,7 @@ class config
   {
     global $ui;
 
-    if (($this->ldapLink === NULL) || ($this->ldapLink->cid === FALSE)) {
+    if ($this->ldapLink === NULL || !is_resource($this->ldapLink->cid)) {
       /* Build new connection */
       $this->ldapLink = LDAP::init($this->current['SERVER'], $this->current['BASE'],
           $this->current['ADMINDN'], $this->get_credentials($this->current['ADMINPASSWORD']));
diff --git a/include/class_ldap.inc b/include/class_ldap.inc
index e44eab6e4f54e1d9fbb67793e5168b1b95df52fd..df420ee05f08ea6f973110e0f7f431ffc4201968 100644
--- a/include/class_ldap.inc
+++ b/include/class_ldap.inc
@@ -37,12 +37,8 @@ class LDAP
   var $reconnect      = FALSE;
   var $tls            = FALSE;
 
-  /**
-   * Connection identifier
-   *
-   * @var resource|object|false
-   */
-  var $cid            = FALSE;
+  /* connection identifier */
+  var $cid;
 
   var $hasres         = [];
   var $sr             = [];
@@ -298,7 +294,7 @@ class LDAP
   function unbind ()
   {
     @ldap_unbind($this->cid);
-    $this->cid = FALSE;
+    $this->cid = NULL;
     logging::debug(DEBUG_LDAP, __LINE__, __FUNCTION__, __FILE__, '', 'unbind');
   }
 
@@ -773,8 +769,9 @@ class LDAP
       $r = ldap_rename($this->cid, $source, $dest_rdn, $parent, TRUE);
       $this->error = ldap_error($this->cid);
 
-      /* Check if destination dn exists, if not the server may not support this operation */
-      $r &= $this->dn_exists($dest);
+      /* Check if destination dn exists, if not the
+          server may not support this operation */
+      $r &= is_resource($this->dn_exists($dest));
       logging::debug(DEBUG_LDAP, __LINE__, __FUNCTION__, __FILE__, $this->error, 'rename("'.$source.'","'.$dest.'")');
       return $r;
     } else {
@@ -1205,7 +1202,7 @@ class LDAP
 
     // Try to open the process
     $process = proc_open($cmd, $descriptorspec, $pipes);
-    if ($process !== FALSE) {
+    if (is_resource($process)) {
       // Write the password to stdin
       fclose($pipes[0]);
 
@@ -1224,10 +1221,10 @@ class LDAP
     return $res;
   }
 
-  function dn_exists ($dn): bool
+  function dn_exists ($dn)
   {
     logging::debug(DEBUG_LDAP, __LINE__, __FUNCTION__, __FILE__, '', 'dn_exists('.$dn.')');
-    return (@ldap_read($this->cid, $dn, '(objectClass=*)', ['objectClass']) !== FALSE);
+    return @ldap_read($this->cid, $dn, "(objectClass=*)", ["objectClass"]);
   }
 
   function parseLdif (string $str_attr): array