From 1b336456ce3ae58f7fd522f6a6529773623a39b1 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 1 Nov 2021 02:44:14 +0100 Subject: [PATCH] Code comment --- htdocs/core/class/ldap.class.php | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) diff --git a/htdocs/core/class/ldap.class.php b/htdocs/core/class/ldap.class.php index e2ce33cc45f..4e0c2bd83ca 100644 --- a/htdocs/core/class/ldap.class.php +++ b/htdocs/core/class/ldap.class.php @@ -292,12 +292,12 @@ class Ldap } - /** - * Simply closes the connection set up earlier. - * Returns true if OK, false if there was an error. + * Simply closes the connection set up earlier. Returns true if OK, false if there was an error. + * This method seems a duplicate/alias of unbind(). * * @return boolean true or false + * @see unbind() */ public function close() { @@ -349,16 +349,21 @@ class Ldap } /** - * Unbind du serveur ldap. + * Unbind of LDAP server (close connection). * * @return boolean true or false + * @see close() */ public function unbind() { - if (!$this->result = @ldap_unbind($this->connection)) { - return false; - } else { + $this->result = true; + if ($this->connection) { + $this->result = @ldap_unbind($this->connection); + } + if ($this->result) { return true; + } else { + return false; } }