8000 fix merge · symfony/symfony@02adcc3 · GitHub
[go: up one dir, main page]

Skip to content

Commit 02adcc3

Browse files
fix merge
1 parent f820978 commit 02adcc3

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

src/Symfony/Component/Form/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)
0