File tree 2 files changed +22
-1
lines changed
2 files changed +22
-1
lines changed Original file line number Diff line number Diff line change @@ -124,7 +124,12 @@ public function clearRememberMeCookie(): void
124
124
return ;
125
125
}
126
126
127
- $ rememberMeDetails = RememberMeDetails::fromRawCookie ($ cookie );
127
+ try {
128
+ $ rememberMeDetails = RememberMeDetails::fromRawCookie ($ cookie );
129
+ } catch (AuthenticationException ) {
130
+ // malformed cookie should not fail the response and can be simply ignored
131
+ return ;
132
+ }
128
133
[$ series ] = explode (': ' , $ rememberMeDetails ->getValue ());
129
134
$ this ->tokenProvider ->deleteTokenBySeries ($ series );
130
135
}
Original file line number Diff line number Diff line change @@ -74,6 +74,22 @@ public function testClearRememberMeCookie()
74
74
$ this ->assertNull ($ cookie ->getValue ());
75
75
}
76
76
77
+ public function testClearRememberMeCookieMalformedCookie ()
78
+ {
79
+ $ this ->tokenProvider ->expects ($ this ->exactly (0 ))
80
+ ->method ('deleteTokenBySeries ' );
81
+
82
+ $ this ->request ->cookies ->set ('REMEMBERME ' , 'malformed ' );
83
+
84
+ $ this ->handler ->clearRememberMeCookie ();
85
+
86
+ $ this ->assertTrue ($ this ->request ->attributes ->has (ResponseListener::COOKIE_ATTR_NAME ));
87
+
88
+ /** @var Cookie $cookie */
89
+ $ cookie = $ this ->request ->attributes ->get (ResponseListener::COOKIE_ATTR_NAME );
90
+ $ this ->assertNull ($ cookie ->getValue ());
91
+ }
92
+
77
93
public function testConsumeRememberMeCookieValid ()
78
94
{
79
95
$ this ->tokenProvider ->expects ($ this ->any ())
You can’t perform that action at this time.
0 commit comments