Fix LDAP Authentification failure with error 500

This commit is contained in:
yann.droniou 2023-02-21 14:26:29 +01:00
parent b0cf8cd72d
commit 9b6e0bab00

View File

@ -344,12 +344,7 @@ class Ldap
*/ */
public function close() public function close()
{ {
$r_type = get_resource_type($this->connection); return $this->unbind();
if ($this->connection && ($r_type === "Unknown" || !@ldap_close($this->connection))) {
return false;
} else {
return true;
}
} }
/** /**
@ -401,7 +396,7 @@ class Ldap
public function unbind() public function unbind()
{ {
$this->result = true; $this->result = true;
if ($this->connection) { if (is_resource($this->connection)) {
$this->result = @ldap_unbind($this->connection); $this->result = @ldap_unbind($this->connection);
} }
if ($this->result) { if ($this->result) {