diff --git a/htdocs/admin/ldap.php b/htdocs/admin/ldap.php
index 13ec3c5d364..63b8b2e0d8f 100644
--- a/htdocs/admin/ldap.php
+++ b/htdocs/admin/ldap.php
@@ -263,7 +263,6 @@ if (function_exists("ldap_connect"))
{
// Test ldap_connect
$ds = dolibarr_ldap_connect();
- print "x".$ds;
if ($ds)
{
print img_picto('','info');
@@ -279,15 +278,18 @@ if (function_exists("ldap_connect"))
}
// Test ldap_getversion
- if ((dolibarr_ldap_getversion($ds) == 3))
+ if ($ds)
{
- print img_picto('','info');
- print $langs->trans("LDAPSetupForVersion3").'
';
- }
- else
- {
- print img_picto('','info');
- print $langs->trans("LDAPSetupForVersion2").'
';
+ if ((dolibarr_ldap_getversion($ds) == 3))
+ {
+ print img_picto('','info');
+ print $langs->trans("LDAPSetupForVersion3").'
';
+ }
+ else
+ {
+ print img_picto('','info');
+ print $langs->trans("LDAPSetupForVersion2").'
';
+ }
}
// Test ldap_bind
diff --git a/htdocs/lib/ldap.lib.php b/htdocs/lib/ldap.lib.php
index 203e1d375ff..025ade58e17 100644
--- a/htdocs/lib/ldap.lib.php
+++ b/htdocs/lib/ldap.lib.php
@@ -57,13 +57,12 @@ function dolibarr_ldap_connect()
if ($ldapconnect)
{
ldap_set_option($ldapconnect, LDAP_OPT_PROTOCOL_VERSION, $conf->global->LDAP_SERVER_PROTOCOLVERSION);
+ return $ldapconnect;
}
else
{
$this->err .= ldap_error($ldapconnect);
}
-
- return $ldapconnect;
}