diff options
author | Fabien Potencier <fabien.potencier@gmail.com> | 2015-05-15 16:12:58 +0200 |
---|---|---|
committer | Fabien Potencier <fabien.potencier@gmail.com> | 2015-05-15 16:12:58 +0200 |
commit | 432e908e87ee22f69eb079394d3ef8b2d6d62773 (patch) | |
tree | 012b166fde72169cd78a7eca6093c4e9e82cf517 | |
parent | 34bcfc3debc0b7e1fbc68b1bedf98e21163f4967 (diff) | |
parent | 78f5c208ae71bd7d9a04ee65c331ec45fd6caafc (diff) | |
download | symfony-security-432e908e87ee22f69eb079394d3ef8b2d6d62773.zip symfony-security-432e908e87ee22f69eb079394d3ef8b2d6d62773.tar.gz symfony-security-432e908e87ee22f69eb079394d3ef8b2d6d62773.tar.bz2 |
minor #14581 [Security] Removed unnecessary statement (MacDada)
This PR was merged into the 2.7 branch.
Discussion
----------
[Security] Removed unnecessary statement
| Q | A
| ------------- | ---
| Bug fix? | no
| New feature? | no
| BC breaks? | no
| Deprecations? | no
| Tests pass? | yes
| Fixed tickets | ~
| License | MIT
| Doc PR | ~
Removed unnecessary statement from `PersistentTokenBasedRememberMeServices.php`.
`$series` comes from `$cookieParts` and `$this->tokenProvider->loadTokenBySeries($series);` is supposed to find the token with that value. Doing `$persistentToken->getSeries();` should give us exactly the same value, so it is an unnecessary statement.
Why?
* We don't need it? We won't miss it when it's gone.
* It confuses a code reader who starts guessing why would that be needed (at least I did and lost time because of that).
Unless…
It actually is needed, as we want `TokenProviderInterface` implementations to have a possibility to give a `PersistentTokenInterface` with a different series value than asked… I can make a PR to the testing class so that such requirement is checked upon.
I don't believe that this is BC, as this behaviour isn't documented anywhere and no existing (known to me) implementations return different series than the asked ones (and current tests pass successfully).
Commits
-------
c7a91f1 Removed unnecessary statement from PersistentTokenBasedRememberMeServices.php
-rw-r--r-- | Http/RememberMe/PersistentTokenBasedRememberMeServices.php | 1 |
1 files changed, 0 insertions, 1 deletions
diff --git a/Http/RememberMe/PersistentTokenBasedRememberMeServices.php b/Http/RememberMe/PersistentTokenBasedRememberMeServices.php index f800668..4fb7e09 100644 --- a/Http/RememberMe/PersistentTokenBasedRememberMeServices.php +++ b/Http/RememberMe/PersistentTokenBasedRememberMeServices.php @@ -98,7 +98,6 @@ class PersistentTokenBasedRememberMeServices extends AbstractRememberMeServices throw new AuthenticationException('The cookie has expired.'); } - $series = $persistentToken->getSeries(); $tokenValue = base64_encode($this->secureRandom->nextBytes(64)); $this->tokenProvider->updateToken($series, $tokenValue, new \DateTime()); $request->attributes->set(self::COOKIE_ATTR_NAME, |