Skip to content

Commit a4e3bb2

Browse files
Merge branch '2.6' into 2.7
* 2.6: Add test for HHVM FatalErrors [2.6][Debug] Fix fatal-errors handling on HHVM [2.3][Debug] Fix fatal-errors handling on HHVM Standardize the name of the exception variables [2.3] Static Code Analysis for Components Remove duplicated paths Conflicts: src/Symfony/Component/Debug/ErrorHandler.php src/Symfony/Component/Security/Http/Firewall/BasicAuthenticationListener.php src/Symfony/Component/Security/Http/Firewall/ContextListener.php src/Symfony/Component/Security/Http/Firewall/RememberMeListener.php src/Symfony/Component/Security/Http/RememberMe/AbstractRememberMeServices.php
2 parents b3979c6 + 0af6563 commit a4e3bb2

File tree

3 files changed

+17
-17
lines changed

3 files changed

+17
-17
lines changed

Authentication/Provider/DaoAuthenticationProvider.php

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -87,13 +87,13 @@ protected function retrieveUser($username, UsernamePasswordToken $token)
8787
}
8888

8989
return $user;
90-
} catch (UsernameNotFoundException $notFound) {
91-
$notFound->setUsername($username);
92-
throw $notFound;
93-
} catch (\Exception $repositoryProblem) {
94-
$ex = new AuthenticationServiceException($repositoryProblem->getMessage(), 0, $repositoryProblem);
95-
$ex->setToken($token);
96-
throw $ex;
90+
} catch (UsernameNotFoundException $e) {
91+
$e->setUsername($username);
92+
throw $e;
93+
} catch (\Exception $e) {
94+
$e = new AuthenticationServiceException($e->getMessage(), 0, $e);
95+
$e->setToken($token);
96+
throw $e;
9797
}
9898
}
9999
}

Authentication/Provider/UserAuthenticationProvider.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -68,13 +68,13 @@ public function authenticate(TokenInterface $token)
6868

6969
try {
7070
$user = $this->retrieveUser($username, $token);
71-
} catch (UsernameNotFoundException $notFound) {
71+
} catch (UsernameNotFoundException $e) {
7272
if ($this->hideUserNotFoundExceptions) {
73-
throw new BadCredentialsException('Bad credentials.', 0, $notFound);
73+
throw new BadCredentialsException('Bad credentials.', 0, $e);
7474
}
75-
$notFound->setUsername($username);
75+
$e->setUsername($username);
7676

77-
throw $notFound;
77+
throw $e;
7878
}
7979

8080
if (!$user instanceof UserInterface) {

User/ChainUserProvider.php

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ public function loadUserByUsername($username)
4747
foreach ($this->providers as $provider) {
4848
try {
4949
return $provider->loadUserByUsername($username);
50-
} catch (UsernameNotFoundException $notFound) {
50+
} catch (UsernameNotFoundException $e) {
5151
// try next one
5252
}
5353
}
@@ -67,18 +67,18 @@ public function refreshUser(UserInterface $user)
6767
foreach ($this->providers as $provider) {
6868
try {
6969
return $provider->refreshUser($user);
70-
} catch (UnsupportedUserException $unsupported) {
70+
} catch (UnsupportedUserException $e) {
7171
// try next one
72-
} catch (UsernameNotFoundException $notFound) {
72+
} catch (UsernameNotFoundException $e) {
7373
$supportedUserFound = true;
7474
// try next one
7575
}
7676
}
7777

7878
if ($supportedUserFound) {
79-
$ex = new UsernameNotFoundException(sprintf('There is no user with name "%s".', $user->getUsername()));
80-
$ex->setUsername($user->getUsername());
81-
throw $ex;
79+
$e = new UsernameNotFoundException(sprintf('There is no user with name "%s".', $user->getUsername()));
80+
$e->setUsername($user->getUsername());
81+
throw $e;
8282
} else {
8383
throw new UnsupportedUserException(sprintf('The account "%s" is not supported.', get_class($user)));
8484
}

0 commit comments

Comments
 (0)