Skip to content

Commit a7b6bf5

Browse files
author
robin.kluth
committed
Catch an bool return from ldap_search in case of any error there
1 parent 5460215 commit a7b6bf5

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

src/LdapAuth.php

+5
Original file line numberDiff line numberDiff line change
@@ -376,6 +376,11 @@ public function searchUser(string $searchFor, $attributes = "", $searchFilter =
376376
$result = @ldap_search($this->_l, $this->_ldapBaseDn, $searchFilter, $attributes, 0, 0, 0, LDAP_DEREF_NEVER, [
377377
['oid' => LDAP_CONTROL_PAGEDRESULTS, 'value' => ['size' => 500, 'cookie' => $cookie]]
378378
]);
379+
if (!$result) {
380+
// Something is wrong with the search query
381+
Yii::warning('ldap_search_error: ' . ldap_error($this->_l));
382+
break;
383+
}
379384
ldap_parse_result($this->_l, $result, $errcode, $matcheddn, $errmsg, $referrals, $controls);
380385

381386

0 commit comments

Comments
 (0)