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 @@ -100,7 +100,8 @@ public function setToken(?string $token = null) : static
100100 */
101101 public function getUserToken () : ?string
102102 {
103- return $ this ->request ->getParsedBody ($ this ->getTokenName ());
103+ $ token = $ this ->request ->getParsedBody ($ this ->getTokenName ());
104+ return \is_string ($ token ) ? $ token : null ;
104105 }
105106
106107 /**
Original file line number Diff line number Diff line change @@ -76,6 +76,17 @@ public function testUserTokenEmpty() : void
7676 self ::assertFalse ($ this ->anti ->verify ());
7777 }
7878
79+ public function testUserTokenIsNotString () : void
80+ {
81+ $ this ->prepare ();
82+ $ _POST = [
83+ 'csrf_token ' => [
84+ 'foo ' => 'bar ' ,
85+ ],
86+ ];
87+ self ::assertFalse ($ this ->anti ->verify ());
88+ }
89+
7990 public function testVerifySuccess () : void
8091 {
8192 $ this ->prepare ();
You can’t perform that action at this time.
0 commit comments