Skip to content

Commit fc8568d

Browse files
Merge branch '6.1' into 6.2
* 6.1: [DI] fix tests [FrameworkBundle] fix merge [FrameworkBundle] Filter out trans paths that are covered by a parent folder path [Form] fix tests [Serializer] Fixed framework.serializer.default_context is not working for JsonEncoder [Ldap] Do not run ldap_set_option on failed connection Correct compare float data Bugfix: add \UnitEnum as a result of get() method Fix AbstractFormLoginAuthenticator return types (fixes #47571). Run composer with --ignore-platform-req=php+ [FrameworkBundle] Fix a phpdoc in mailer assertions
2 parents 1fc548d + b793d89 commit fc8568d

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

Adapter/ExtLdap/Connection.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -150,18 +150,18 @@ private function connect()
150150
}
151151
}
152152

153-
$this->connection = ldap_connect($this->config['connection_string']);
153+
if (false === $connection = ldap_connect($this->config['connection_string'])) {
154+
throw new LdapException('Invalid connection string: '.$this->config['connection_string']);
155+
} else {
156+
$this->connection = $connection;
157+
}
154158

155159
foreach ($this->config['options'] as $name => $value) {
156160
if (!\in_array(ConnectionOptions::getOption($name), self::PRECONNECT_OPTIONS, true)) {
157161
$this->setOption($name, $value);
158162
}
159163
}
160164

161-
if (false === $this->connection) {
162-
throw new LdapException('Could not connect to Ldap server: '.ldap_error($this->connection));
163-
}
164-
165165
if ('tls' === $this->config['encryption'] && false === @ldap_start_tls($this->connection)) {
166166
throw new LdapException('Could not initiate TLS connection: '.ldap_error($this->connection));
167167
}

0 commit comments

Comments
 (0)