File tree Expand file tree Collapse file tree 2 files changed +13
-1
lines changed
Expand file tree Collapse file tree 2 files changed +13
-1
lines changed Original file line number Diff line number Diff line change @@ -162,7 +162,8 @@ public function generateToken() : string
162162 */
163163 public function getUserToken () : ?string
164164 {
165- return $ this ->request ->getParsedBody ($ this ->getTokenName ());
165+ $ token = $ this ->request ->getParsedBody ($ this ->getTokenName ());
166+ return \is_string ($ token ) ? $ token : null ;
166167 }
167168
168169 /**
Original file line number Diff line number Diff line change @@ -152,6 +152,17 @@ public function testUserTokenEmpty() : void
152152 self ::assertFalse ($ this ->anti ->verify ());
153153 }
154154
155+ public function testUserTokenIsNotString () : void
156+ {
157+ $ this ->prepare ();
158+ $ _POST = [
159+ 'csrf_token ' => [
160+ 'foo ' => 'bar ' ,
161+ ],
162+ ];
163+ self ::assertFalse ($ this ->anti ->verify ());
164+ }
165+
155166 public function testVerifySuccess () : void
156167 {
157168 $ this ->prepare ();
You can’t perform that action at this time.
0 commit comments