File tree Expand file tree Collapse file tree 1 file changed +4
-2
lines changed
Extension/Csrf/EventListener Expand file tree Collapse file tree 1 file changed +4
-2
lines changed Original file line number Diff line number Diff line change @@ -66,8 +66,10 @@ public function preSubmit(FormEvent $event)
6666 if ($ form ->isRoot () && $ form ->getConfig ()->getOption ('compound ' ) && !$ postRequestSizeExceeded ) {
6767 $ data = $ event ->getData ();
6868
69- $ csrfToken = new CsrfToken ($ this ->tokenId , $ data [$ this ->fieldName ] ?? null );
70- if (!isset ($ data [$ this ->fieldName ]) || !\is_string ($ data [$ this ->fieldName ]) || !$ this ->tokenManager ->isTokenValid ($ csrfToken )) {
69+ $ csrfValue = \is_string ($ data [$ this ->fieldName ] ?? null ) ? $ data [$ this ->fieldName ] : null ;
70+ $ csrfToken = new CsrfToken ($ this ->tokenId , $ csrfValue );
71+
72+ if (null === $ csrfValue || !$ this ->tokenManager ->isTokenValid ($ csrfToken )) {
7173 $ errorMessage = $ this ->errorMessage ;
7274
7375 if (null !== $ this ->translator ) {
You can’t perform that action at this time.
0 commit comments