Skip to content

Commit b793d89

Browse files
Merge branch '6.0' into 6.1
* 6.0: [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 788a28d + e8a434f commit b793d89

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
@@ -155,18 +155,18 @@ private function connect()
155155
}
156156
}
157157

158-
$this->connection = ldap_connect($this->config['connection_string']);
158+
if (false === $connection = ldap_connect($this->config['connection_string'])) {
159+
throw new LdapException('Invalid connection string: '.$this->config['connection_string']);
160+
} else {
161+
$this->connection = $connection;
162+
}
159163

160164
foreach ($this->config['options'] as $name => $value) {
161165
if (!\in_array(ConnectionOptions::getOption($name), self::PRECONNECT_OPTIONS, true)) {
162166
$this->setOption($name, $value);
163167
}
164168
}
165169

166-
if (false === $this->connection) {
167-
throw new LdapException('Could not connect to Ldap server: '.ldap_error($this->connection));
168-
}
169-
170170
if ('tls' === $this->config['encryption'] && false === @ldap_start_tls($this->connection)) {
171171
throw new LdapException('Could not initiate TLS connection: '.ldap_error($this->connection));
172172
}

0 commit comments

Comments
 (0)