diff --git a/htdocs/admin/ldap.php b/htdocs/admin/ldap.php index ce4ba1725832b26a417e72469e6398b1abaede55..53c8777d40454e2f97b20dc61022e3c93518562d 100644 --- a/htdocs/admin/ldap.php +++ b/htdocs/admin/ldap.php @@ -263,7 +263,7 @@ if (function_exists("ldap_connect")) $ldap = new Ldap(); // Les parametres sont passes et recuperes via $conf $result = $ldap->connect_bind(); - if ($result) + if ($result > 0) { // Test ldap connect and bind print img_picto('','info').' '; diff --git a/htdocs/core/class/ldap.class.php b/htdocs/core/class/ldap.class.php index 98250ab0db1a6143ed6b1b5e71d5cd6afc29a67d..400eb934e266ebd09ec5e9e718a1c63f21237e29 100644 --- a/htdocs/core/class/ldap.class.php +++ b/htdocs/core/class/ldap.class.php @@ -156,10 +156,17 @@ class Ldap if (count($this->server) == 0 || empty($this->server[0])) { $this->error='LDAP setup (file conf.php) is not complete'; - $return=-1; dol_syslog(get_class($this)."::connect_bind ".$this->error, LOG_WARNING); + return -1; } + if (! function_exists('ldap_connect')) + { + $this->error='Your PHP need extension ldap'; + dol_syslog(get_class($this)."::connect_bind ".$this->error, LOG_WARNING); + return -1; + } + // Loop on each ldap server foreach ($this->server as $key => $host) {