get adLDAPUsers::info() to return false again instead of throwing under PHP 8.x

This commit is contained in:
ralf 2022-11-09 12:32:04 +01:00
parent 5f6ab54c83
commit cbb2b4f5cd

View File

@ -1719,6 +1719,29 @@ class adLDAPUsers extends \adLDAPUsers
}
return true;
}
/**
* Find information about the users. Returned in a raw array format from AD.
*
* Reimplemented to deal with InvalidArgumentException caused by calling
* ldap_search or ldap_get_entries under PHP 8.x.
*
* @param string $username The username to query
* @param array $fields Array of parameters to query
* @param bool $isGUID Is the username passed a GUID or a samAccountName
*
* @return array|false false on error
*/
public function info($username, $fields = null, $isGUID = false)
{
try {
return parent::info($username, $fields, $isGUID);
}
catch(\InvalidArgumentException $e) {
// ignore the exceptions caused by calling ldap_get_entries or ldap_get_entries under PHP 8.x
}
return false;
}
}
/**