Thanks to visit codestin.com
Credit goes to github.com

Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,12 @@ public function clearRememberMeCookie(): void
return;
}

$rememberMeDetails = RememberMeDetails::fromRawCookie($cookie);
try {
$rememberMeDetails = RememberMeDetails::fromRawCookie($cookie);
} catch (AuthenticationException) {
// malformed cookie should not fail the response and can be simply ignored
return;
}
[$series] = explode(':', $rememberMeDetails->getValue());
$this->tokenProvider->deleteTokenBySeries($series);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,22 @@ public function testClearRememberMeCookie()
$this->assertNull($cookie->getValue());
}

public function testClearRememberMeCookieMalformedCookie()
{
$this->tokenProvider->expects($this->exactly(0))
->method('deleteTokenBySeries');

$this->request->cookies->set('REMEMBERME', 'malformed');

$this->handler->clearRememberMeCookie();

$this->assertTrue($this->request->attributes->has(ResponseListener::COOKIE_ATTR_NAME));

/** @var Cookie $cookie */
$cookie = $this->request->attributes->get(ResponseListener::COOKIE_ATTR_NAME);
$this->assertNull($cookie->getValue());
}

public function testConsumeRememberMeCookieValid()
{
$this->tokenProvider->expects($this->any())
Expand Down