Skip to content

Commit 98cabc9

Browse files
fix merge
1 parent 49a0107 commit 98cabc9

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

Extension/Csrf/EventListener/CsrfValidationListener.php

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff 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) {

0 commit comments

Comments
 (0)