summaryrefslogtreecommitdiffstats
path: root/core
diff options
context:
space:
mode:
authorMorris Jobke <hey@morrisjobke.de>2019-07-10 12:16:36 +0200
committerGitHub <noreply@github.com>2019-07-10 12:16:36 +0200
commit5c21b29d7f837c2a6f22c32c922a769c1aa254ce (patch)
tree1029bd7e58244d0e8da8d786755337c64dd143e8 /core
parentb120f57975723acaa31161f7f542cae3d43a8e75 (diff)
parentd57540ac8460c746baf65323fa8af6db07a58db7 (diff)
downloadnextcloud-server-5c21b29d7f837c2a6f22c32c922a769c1aa254ce.tar.gz
nextcloud-server-5c21b29d7f837c2a6f22c32c922a769c1aa254ce.zip
Merge pull request #16308 from nextcloud/fix/undefined-offset-0
Prevent undefined offset 0 in findByUserIdOrMail
Diffstat (limited to 'core')
-rw-r--r--core/Controller/LostController.php9
1 files changed, 6 insertions, 3 deletions
diff --git a/core/Controller/LostController.php b/core/Controller/LostController.php
index 96018555ec3..5ac0557e5d6 100644
--- a/core/Controller/LostController.php
+++ b/core/Controller/LostController.php
@@ -50,6 +50,9 @@ use OCP\IUserManager;
use OCP\Mail\IMailer;
use OCP\Security\ICrypto;
use OCP\Security\ISecureRandom;
+use function array_filter;
+use function count;
+use function reset;
/**
* Class LostController
@@ -389,12 +392,12 @@ class LostController extends Controller {
return $user;
}
- $users = \array_filter($this->userManager->getByEmail($input), function (IUser $user) {
+ $users = array_filter($this->userManager->getByEmail($input), function (IUser $user) {
return $user->isEnabled();
});
- if (\count($users) === 1) {
- return $users[0];
+ if (count($users) === 1) {
+ return reset($users);
}
throw $userNotFound;