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

Commit 39f14bc

Browse files
committed
assign more accurately when host contains schema during connection process
1 parent a32fecd commit 39f14bc

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

src/Ldap.php

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -705,9 +705,10 @@ public function connect($host = null, $port = null, $useSsl = null, $useStartTls
705705
* connect string here for reporting it in error handling in bind().
706706
*/
707707
$hosts = [];
708-
if (preg_match_all('~ldap(?:i|s)?://~', $host, $hosts, PREG_SET_ORDER) > 0) {
708+
if (preg_match_all('~ldap(i|s)?://~', $host, $hosts, PREG_SET_ORDER) > 0) {
709709
$this->connectString = $host;
710-
$useSsl = false;
710+
// assign $useSsl to true in case of ldaps schema
711+
$useSsl = (isset($hosts[0][1]) && $hosts[0][1] = 's') ? true : false;
711712
} else {
712713
if ($useSsl) {
713714
$this->connectString = 'ldaps://' . $host;

0 commit comments

Comments
 (0)