@@ -93,14 +93,18 @@ public function load(array $configs, ContainerBuilder $container)
93
93
94
94
$ loader ->load ('security.xml ' );
95
95
96
- $ this ->registerSecurityCsrfConfiguration ($ config ['csrf_protection ' ], $ container , $ loader );
97
-
98
96
if ($ this ->isConfigEnabled ($ container , $ config ['form ' ])) {
99
97
$ this ->formConfigEnabled = true ;
100
98
$ this ->registerFormConfiguration ($ config , $ container , $ loader );
101
99
$ config ['validation ' ]['enabled ' ] = true ;
100
+
101
+ if ($ this ->isConfigEnabled ($ container , $ config ['form ' ]['csrf_protection ' ])) {
102
+ $ config ['csrf_protection ' ]['enabled ' ] = true ;
103
+ }
102
104
}
103
105
106
+ $ this ->registerSecurityCsrfConfiguration ($ config ['csrf_protection ' ], $ container , $ loader );
107
+
104
108
if (isset ($ config ['templating ' ])) {
105
109
$ this ->registerTemplatingConfiguration ($ config ['templating ' ], $ config ['ide ' ], $ container , $ loader );
106
110
}
@@ -159,10 +163,6 @@ private function registerFormConfiguration($config, ContainerBuilder $container,
159
163
{
160
164
$ loader ->load ('form.xml ' );
161
165
if ($ this ->isConfigEnabled ($ container , $ config ['form ' ]['csrf_protection ' ])) {
162
- if (!$ this ->isConfigEnabled ($ container , $ config ['csrf_protection ' ])) {
163
- throw new \LogicException ('CSRF protection needs to be enabled in order to use CSRF protection for forms. ' );
164
- }
165
-
166
166
$ loader ->load ('form_csrf.xml ' );
167
167
168
168
$ container ->setParameter ('form.type_extension.csrf.enabled ' , true );
0 commit comments