@@ -29,6 +29,12 @@ class Connection extends AbstractConnection
29
29
private const LDAP_INVALID_CREDENTIALS = 0x31 ;
30
30
private const LDAP_TIMEOUT = 0x55 ;
31
31
private const LDAP_ALREADY_EXISTS = 0x44 ;
32
+ private const PRECONNECT_OPTIONS = [
33
+ ConnectionOptions::DEBUG_LEVEL ,
34
+ ConnectionOptions::X_TLS_CACERTDIR ,
35
+ ConnectionOptions::X_TLS_CACERTFILE ,
36
+ ConnectionOptions::X_TLS_REQUIRE_CERT ,
37
+ ];
32
38
33
39
/** @var bool */
34
40
private $ bound = false ;
@@ -147,10 +153,18 @@ private function connect()
147
153
return ;
148
154
}
149
155
156
+ foreach ($ this ->config ['options ' ] as $ name => $ value ) {
157
+ if (\in_array (ConnectionOptions::getOption ($ name ), self ::PRECONNECT_OPTIONS , true )) {
158
+ $ this ->setOption ($ name , $ value );
159
+ }
160
+ }
161
+
150
162
$ this ->connection = ldap_connect ($ this ->config ['connection_string ' ]);
151
163
152
164
foreach ($ this ->config ['options ' ] as $ name => $ value ) {
153
- $ this ->setOption ($ name , $ value );
165
+ if (!\in_array (ConnectionOptions::getOption ($ name ), self ::PRECONNECT_OPTIONS , true )) {
166
+ $ this ->setOption ($ name , $ value );
167
+ }
154
168
}
155
169
156
170
if (false === $ this ->connection ) {
0 commit comments