]> source.dussan.org Git - nextcloud-server.git/commitdiff
Simplify array filter
authorJoas Schilling <coding@schilljs.com>
Thu, 19 Mar 2020 13:14:37 +0000 (14:14 +0100)
committerJoas Schilling <coding@schilljs.com>
Wed, 19 Aug 2020 09:20:36 +0000 (11:20 +0200)
Signed-off-by: Joas Schilling <coding@schilljs.com>
lib/private/Security/Bruteforce/Throttler.php

index 1e92eeed3b21f86f4176d27a0e21d8cfdeb2e1d1..ef870f4b99a15a9ed2ab5ab61e8cd62e9ed846c6 100644 (file)
@@ -162,8 +162,7 @@ class Throttler {
 
                $keys = $this->config->getAppKeys('bruteForce');
                $keys = array_filter($keys, function ($key) {
-                       $regex = '/^whitelist_/S';
-                       return preg_match($regex, $key) === 1;
+                       return 0 === strpos($key, 'whitelist_');
                });
 
                if (filter_var($ip, FILTER_VALIDATE_IP, FILTER_FLAG_IPV4)) {