Skip to content

Commit 7f12e57

Browse files
committed
Merge branch '4.4' into 5.1
* 4.4: [HttpFoundation] Drop int return type from parseFilesize() Added $translator->addLoader() bug symfony/symfony#39878 [doctrine-bridge] Add username to UserNameNotFoundException fix spelling Add check for constant in Curl client Revert #38614, add assert to avoid regression Fix problem when SYMFONY_PHPUNIT_VERSION is empty string value Update PHP CS Fixer config to v2.18
2 parents 908d89b + 122eb9b commit 7f12e57

File tree

1 file changed

+12
-3
lines changed

1 file changed

+12
-3
lines changed

Security/LdapUserProvider.php

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -73,18 +73,27 @@ public function loadUserByUsername(string $username)
7373
$query = str_replace('{username}', $username, $this->defaultSearch);
7474
$search = $this->ldap->query($this->baseDn, $query);
7575
} catch (ConnectionException $e) {
76-
throw new UsernameNotFoundException(sprintf('User "%s" not found.', $username), 0, $e);
76+
$e = new UsernameNotFoundException(sprintf('User "%s" not found.', $username), 0, $e);
77+
$e->setUsername($username);
78+
79+
throw $e;
7780
}
7881

7982
$entries = $search->execute();
8083
$count = \count($entries);
8184

8285
if (!$count) {
83-
throw new UsernameNotFoundException(sprintf('User "%s" not found.', $username));
86+
$e = new UsernameNotFoundException(sprintf('User "%s" not found.', $username));
87+
$e->setUsername($username);
88+
89+
throw $e;
8490
}
8591

8692
if ($count > 1) {
87-
throw new UsernameNotFoundException('More than one user found.');
93+
$e = new UsernameNotFoundException('More than one user found.');
94+
$e->setUsername($username);
95+
96+
throw $e;
8897
}
8998

9099
$entry = $entries[0];

0 commit comments

Comments
 (0)