File tree 1 file changed +5
-5
lines changed
src/Symfony/Component/Ldap/Adapter/ExtLdap
1 file changed +5
-5
lines changed Original file line number Diff line number Diff line change @@ -159,18 +159,18 @@ private function connect()
159
159
}
160
160
}
161
161
162
- $ this ->connection = ldap_connect ($ this ->config ['connection_string ' ]);
162
+ if (false === $ connection = ldap_connect ($ this ->config ['connection_string ' ])) {
163
+ throw new LdapException ('Invalid connection string: ' .$ this ->config ['connection_string ' ]);
164
+ } else {
165
+ $ this ->connection = $ connection ;
166
+ }
163
167
164
168
foreach ($ this ->config ['options ' ] as $ name => $ value ) {
165
169
if (!\in_array (ConnectionOptions::getOption ($ name ), self ::PRECONNECT_OPTIONS , true )) {
166
170
$ this ->setOption ($ name , $ value );
167
171
}
168
172
}
169
173
170
- if (false === $ this ->connection ) {
171
- throw new LdapException ('Could not connect to Ldap server: ' .ldap_error ($ this ->connection ));
172
- }
173
-
174
174
if ('tls ' === $ this ->config ['encryption ' ] && false === @ldap_start_tls ($ this ->connection )) {
175
175
throw new LdapException ('Could not initiate TLS connection: ' .ldap_error ($ this ->connection ));
176
176
}
You can’t perform that action at this time.
0 commit comments