diff --git a/src/Symfony/Component/Ldap/LdapClient.php b/src/Symfony/Component/Ldap/LdapClient.php index 734ff4e906c2..ebb263d5cf0c 100644 --- a/src/Symfony/Component/Ldap/LdapClient.php +++ b/src/Symfony/Component/Ldap/LdapClient.php @@ -109,11 +109,11 @@ private function connect() $host = 'ldaps://'.$host; } + $this->connection = ldap_connect($host, $this->port); + ldap_set_option($this->connection, LDAP_OPT_PROTOCOL_VERSION, $this->version); ldap_set_option($this->connection, LDAP_OPT_REFERRALS, $this->optReferrals); - $this->connection = ldap_connect($host, $this->port); - if ($this->useStartTls) { ldap_start_tls($this->connection); }