Skip to content
This repository was archived by the owner on Jan 30, 2020. It is now read-only.

Commit a32fecd

Browse files
committed
drop support of non-uri ldap connections (support omly OpenLDAP 2.2 +)
1 parent 1c7c84b commit a32fecd

File tree

1 file changed

+2
-9
lines changed

1 file changed

+2
-9
lines changed

src/Ldap.php

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -700,23 +700,19 @@ public function connect($host = null, $port = null, $useSsl = null, $useStartTls
700700
throw new Exception\LdapException(null, 'A host parameter is required');
701701
}
702702

703-
$useUri = false;
704703
/* Because ldap_connect doesn't really try to connect, any connect error
705704
* will actually occur during the ldap_bind call. Therefore, we save the
706705
* connect string here for reporting it in error handling in bind().
707706
*/
708707
$hosts = [];
709708
if (preg_match_all('~ldap(?:i|s)?://~', $host, $hosts, PREG_SET_ORDER) > 0) {
710709
$this->connectString = $host;
711-
$useUri = true;
712710
$useSsl = false;
713711
} else {
714712
if ($useSsl) {
715713
$this->connectString = 'ldaps://' . $host;
716-
$useUri = true;
717714
} else {
718715
$this->connectString = 'ldap://' . $host;
719-
$useUri = true;
720716
}
721717
if ($port) {
722718
$this->connectString .= ':' . $port;
@@ -725,12 +721,9 @@ public function connect($host = null, $port = null, $useSsl = null, $useStartTls
725721

726722
$this->disconnect();
727723

728-
729-
/* Only OpenLDAP 2.2 + supports URLs so if SSL is not requested, just
730-
* use the old form.
731-
*/
724+
// We supporting here only OpenLDAP 2.2 + which supports URLs (drop support of old-style host/port connections).
732725
ErrorHandler::start();
733-
$resource = ($useUri) ? ldap_connect($this->connectString) : ldap_connect($host, $port);
726+
$resource = ldap_connect($this->connectString);
734727
ErrorHandler::stop();
735728

736729
if (is_resource($resource) === true) {

0 commit comments

Comments
 (0)