8000 merged branch TerjeBr/persistent-token-provider (PR #7534) · symfony/symfony@c65b482 · GitHub
[go: up one dir, main page]

Skip to content

Commit c65b482

Browse files
committed
merged branch TerjeBr/persistent-token-provider (PR #7534)
This PR was merged into the 2.2 branch. Discussion ---------- [Security/Http/RememberMe] PersistentTokenBasedRememberMeServices bugfix | Q | A | ------------- | --- | Bug fix? | yes | New feature? | no | BC breaks? | no | Deprecations? | no | Tests pass? | yes | License | MIT The database and debug layer cannot handle raw random strings. It may contain invalid ut8 characters and whatnot. So, in order to avoid a lot of database bugs, we must base64_encode the random strings. Commits ------- 751abe1 Doctrine cannot handle bare random non-utf8 strings
2 parents b70bb44 + 751abe1 commit c65b482

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

src/Symfony/Component/Security/Http/RememberMe/PersistentTokenBasedRememberMeServices.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@ protected function processAutoLoginCookie(array $cookieParts, Request $request)
9999
}
100100

101101
$series = $persistentToken->getSeries();
102-
$tokenValue = $this->secureRandom->nextBytes(64);
102+
$tokenValue = base64_encode($this->secureRandom->nextBytes(64));
103103
$this->tokenProvider->updateToken($series, $tokenValue, new \DateTime());
104104
$request->attributes->set(self::COOKIE_ATTR_NAME,
105105
new Cookie(
@@ -121,8 +121,8 @@ protected function processAutoLoginCookie(array $cookieParts, Request $request)
121121
*/
122122
protected function onLoginSuccess(Request $request, Response $response, TokenInterface $token)
123123
{
124-
$series = $this->secureRandom->nextBytes(64);
125-
$tokenValue = $this->secureRandom->nextBytes(64);
124+
$series = base64_encode($this->secureRandom->nextBytes(64));
125+
$tokenValue = base64_encode($this->secureRandom->nextBytes(64));
126126

127127
$this->tokenProvider->createNewToken(
128128
new PersistentToken(

0 commit comments

Comments
 (0)
0