Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit d0324e4

Browse filesBrowse files
committed
minor #17763 Remove unnecessary retrieval and setting of data (Trent Steel)
This PR was submitted for the 2.8 branch but it was merged into the 2.3 branch instead (closes #17763). Discussion ---------- Remove unnecessary retrieval and setting of data | Q | A | ------------- | --- | Bug fix? | No | New feature? | No - optimisation | BC breaks? | No | Deprecations? | No | Tests pass? | Yes | Fixed tickets | - | License | MIT | Doc PR | None Commits ------- ea52400 remove unnecessary retrieval and setting of data
2 parents 730a472 + ea52400 commit d0324e4
Copy full SHA for d0324e4

File tree

Expand file treeCollapse file tree

1 file changed

+3
-3
lines changed
Filter options
Expand file treeCollapse file tree

1 file changed

+3
-3
lines changed

‎src/Symfony/Component/Form/Extension/Csrf/EventListener/CsrfValidationListener.php

Copy file name to clipboardExpand all lines: src/Symfony/Component/Form/Extension/Csrf/EventListener/CsrfValidationListener.php
+3-3Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -84,9 +84,10 @@ public function __construct($fieldName, CsrfProviderInterface $csrfProvider, $in
8484
public function preSubmit(FormEvent $event)
8585
{
8686
$form = $event->getForm();
87-
$data = $event->getData();
8887

8988
if ($form->isRoot() && $form->getConfig()->getOption('compound')) {
89+
$data = $event->getData();
90+
9091
if (!isset($data[$this->fieldName]) || !$this->csrfProvider->isCsrfTokenValid($this->intention, $data[$this->fieldName])) {
9192
$errorMessage = $this->errorMessage;
9293

@@ -99,10 +100,9 @@ public function preSubmit(FormEvent $event)
99100

100101
if (is_array($data)) {
101102
unset($data[$this->fieldName]);
103+
$event->setData($data);
102104
}
103105
}
104-
105-
$event->setData($data);
106106
}
107107

108108
/**

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.