File tree Expand file tree Collapse file tree 1 file changed +4
-2
lines changed
src/Symfony/Component/Form/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)
66
66
if ($ form ->isRoot () && $ form ->getConfig ()->getOption ('compound ' ) && !$ postRequestSizeExceeded ) {
67
67
$ data = $ event ->getData ();
68
68
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 )) {
71
73
$ errorMessage = $ this ->errorMessage ;
72
74
73
75
if (null !== $ this ->translator ) {
You can’t perform that action at this time.
0 commit comments