Skip to content

Commit 7259819

Browse files
Merge branch '7.2' into 7.3
* 7.2: [WebProfilerBundle] Fix tests [Cache] Tests for Redis Replication with cache [BrowserKit] Fix submitting forms with empty file fields [Notifier] [BlueSky] Change the value returned as the message ID [WebProfilerBundle] Fix interception for non conventional redirects [DependencyInjection] Do not preload functions [DependencyInjection] Fix cloned lazy services not sharing their dependencies when dumped with PhpDumper [Form][FrameworkBundle] Use auto-configuration to make the default CSRF token id apply only to the app; not to bundles [HttpClient] Fix activity tracking leading to negative timeout errors [Serializer] Handle default context in named Serializer [Security] Return null instead of empty username to fix deprecation notice [DependencyInjection] Fix env default processor with scalar node
2 parents 582d165 + 06b9c6f commit 7259819

File tree

2 files changed

+3
-5
lines changed

2 files changed

+3
-5
lines changed

DependencyInjection/FrameworkExtension.php

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -644,7 +644,7 @@ public function load(array $configs, ContainerBuilder $container): void
644644
$container->registerForAutoconfiguration(DataCollectorInterface::class)
645645
->addTag('data_collector');
646646
$container->registerForAutoconfiguration(FormTypeInterface::class)
647-
->addTag('form.type');
647+
->addTag('form.type', ['csrf_token_id' => '%.form.type_extension.csrf.token_id%']);
648648
$container->registerForAutoconfiguration(FormTypeGuesserInterface::class)
649649
->addTag('form.type_guesser');
650650
$container->registerForAutoconfiguration(FormTypeExtensionInterface::class)
@@ -815,9 +815,7 @@ private function registerFormConfiguration(array $config, ContainerBuilder $cont
815815
$container->setParameter('form.type_extension.csrf.enabled', true);
816816
$container->setParameter('form.type_extension.csrf.field_name', $config['form']['csrf_protection']['field_name']);
817817
$container->setParameter('form.type_extension.csrf.field_attr', $config['form']['csrf_protection']['field_attr']);
818-
819-
$container->getDefinition('form.type_extension.csrf')
820-
->replaceArgument(7, $config['form']['csrf_protection']['token_id']);
818+
$container->setParameter('.form.type_extension.csrf.token_id', $config['form']['csrf_protection']['token_id']);
821819
} else {
822820
$container->setParameter('form.type_extension.csrf.enabled', false);
823821
}

Resources/config/form_csrf.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424
param('validator.translation_domain'),
2525
service('form.server_params'),
2626
param('form.type_extension.csrf.field_attr'),
27-
abstract_arg('framework.form.csrf_protection.token_id'),
27+
param('.form.type_extension.csrf.token_id'),
2828
])
2929
->tag('form.type_extension')
3030
;

0 commit comments

Comments
 (0)