Skip to content

Commit d5f0428

Browse files
committed
bug symfony#25151 [FrameworkBundle] Automatically enable the CSRF protection if CSRF manager exists (sroze)
This PR was merged into the 3.4 branch. Discussion ---------- [FrameworkBundle] Automatically enable the CSRF protection if CSRF manager exists | Q | A | ------------- | --- | Branch? | 3.4 | Bug fix? | no | New feature? | yes | BC breaks? | no | Deprecations? | no | Tests pass? | yes | Fixed tickets | ø | License | MIT This will automatically enable the CSRF protection if `CsrfTokenManagerInterface` exists. Commits ------- fd43406 Automatically enable the CSRF protection if CSRF manager exists
2 parents e52825e + fd43406 commit d5f0428

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

src/Symfony/Bundle/FrameworkBundle/DependencyInjection/Configuration.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
use Symfony\Component\Form\Form;
2222
use Symfony\Component\Lock\Lock;
2323
use Symfony\Component\Lock\Store\SemaphoreStore;
24+
use Symfony\Component\Security\Csrf\CsrfTokenManagerInterface;
2425
use Symfony\Component\Serializer\Serializer;
2526
use Symfony\Component\Translation\Translator;
2627
use Symfony\Component\Validator\Validation;
@@ -142,7 +143,7 @@ private function addCsrfSection(ArrayNodeDefinition $rootNode)
142143
$rootNode
143144
->children()
144145
->arrayNode('csrf_protection')
145-
->canBeEnabled()
146+
->{!class_exists(FullStack::class) && class_exists(CsrfTokenManagerInterface::class) ? 'canBeDisabled' : 'canBeEnabled'}()
146147
->end()
147148
->end()
148149
;

0 commit comments

Comments
 (0)