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 58c3b19c8c
commit 293cf669a0

View File

@ -1810,6 +1810,29 @@ class adLDAPUsers extends \adLDAPUsers
} }
return true; 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;
}
} }
/** /**