diff options
author | Arthur Schiwon <blizzz@arthur-schiwon.de> | 2020-04-02 16:51:12 +0200 |
---|---|---|
committer | Arthur Schiwon <blizzz@arthur-schiwon.de> | 2020-04-02 16:51:12 +0200 |
commit | 9359d8b0a42ecff6c471f70d5225ac9987d159d7 (patch) | |
tree | 6ed4b3c68d8efb9b2952aef1f48b87456b5bde67 /apps/user_ldap/lib | |
parent | a9db39170a4fdcd4543e40c0d5ae4b0f23699167 (diff) | |
download | nextcloud-server-9359d8b0a42ecff6c471f70d5225ac9987d159d7.tar.gz nextcloud-server-9359d8b0a42ecff6c471f70d5225ac9987d159d7.zip |
silence LDAP deprecation logs in NC 18
Signed-off-by: Arthur Schiwon <blizzz@arthur-schiwon.de>
Diffstat (limited to 'apps/user_ldap/lib')
-rw-r--r-- | apps/user_ldap/lib/LDAP.php | 41 |
1 files changed, 33 insertions, 8 deletions
diff --git a/apps/user_ldap/lib/LDAP.php b/apps/user_ldap/lib/LDAP.php index e68c3149696..4f1ebaf810e 100644 --- a/apps/user_ldap/lib/LDAP.php +++ b/apps/user_ldap/lib/LDAP.php @@ -70,12 +70,24 @@ class LDAP implements ILDAPWrapper { * @return bool|LDAP */ public function controlPagedResultResponse($link, $result, &$cookie) { - $this->preFunctionCall('ldap_control_paged_result_response', - array($link, $result, $cookie)); - $result = ldap_control_paged_result_response($link, $result, $cookie); - $this->postFunctionCall(); - - return $result; + $oldHandler = set_error_handler(function($no, $message, $file, $line) use (&$oldHandler) { + if(strpos($message, 'ldap_control_paged_result_response() is deprecated') !== false) { + return true; + } + $oldHandler($no, $message, $file, $line); + return true; + }); + try { + $this->preFunctionCall('ldap_control_paged_result_response', + array($link, $result, $cookie)); + $result = ldap_control_paged_result_response($link, $result, $cookie); + $this->postFunctionCall(); + restore_error_handler(); + return $result; + } catch (\Exception $e) { + restore_error_handler(); + throw $e; + } } /** @@ -86,8 +98,21 @@ class LDAP implements ILDAPWrapper { * @return mixed|true */ public function controlPagedResult($link, $pageSize, $isCritical, $cookie) { - return $this->invokeLDAPMethod('control_paged_result', $link, $pageSize, - $isCritical, $cookie); + $oldHandler = set_error_handler(function($no, $message, $file, $line) use (&$oldHandler) { + if(strpos($message, 'Function ldap_control_paged_result() is deprecated') !== false) { + return true; + } + $oldHandler($no, $message, $file, $line); + return true; + }); + try { + $result = $this->invokeLDAPMethod('control_paged_result', $link, $pageSize, $isCritical, $cookie); + restore_error_handler(); + return $result; + } catch (\Exception $e) { + restore_error_handler(); + throw $e; + } } /** |