Fix ldap_parse_result call

Signed-off-by: Côme Chilliet <come.chilliet@nextcloud.com>
pull/33703/head
Côme Chilliet 2022-09-08 16:29:23 +07:00
parent e872f461f2
commit 81064b3d22
No known key found for this signature in database
GPG Key ID: A3E2F658B28C760A
1 changed files with 13 additions and 4 deletions

@ -86,12 +86,21 @@ class LDAP implements ILDAPWrapper {
$controls = [];
$matchedDn = null;
$referrals = [];
$success = $this->invokeLDAPMethod('parse_result', $link, $result,
/** Cannot use invokeLDAPMethod because arguments are passed by reference */
$this->preFunctionCall('ldap_parse_result', [$link, $result]);
$success = ldap_parse_result($link, $result,
$errorCode,
$matchedDn,
$errorMessage,
$referrals,
$controls);
if ($this->isResultFalse($result)) {
$this->postFunctionCall();
}
if ($this->dataCollector !== null) {
$this->dataCollector->stopLastLdapRequest();
}
$cookie = $controls[LDAP_CONTROL_PAGEDRESULTS]['value']['cookie'] ?? '';
@ -281,11 +290,11 @@ class LDAP implements ILDAPWrapper {
}
/**
* @param array $arguments
* @return mixed
*/
protected function invokeLDAPMethod() {
$arguments = func_get_args();
$func = 'ldap_' . array_shift($arguments);
protected function invokeLDAPMethod(string $func, ...$arguments) {
$func = 'ldap_' . $func;
if (function_exists($func)) {
$this->preFunctionCall($func, $arguments);
$result = call_user_func_array($func, $arguments);