diff --git a/DependencyInjection/Configuration.php b/DependencyInjection/Configuration.php index 9abd10e73..678698f4d 100644 --- a/DependencyInjection/Configuration.php +++ b/DependencyInjection/Configuration.php @@ -211,7 +211,7 @@ private function addCsrfSection(ArrayNodeDefinition $rootNode): void ->addDefaultsIfNotSet() ->fixXmlConfig('stateless_token_id') ->children() - // defaults to framework.csrf_protection.stateless_token_ids || framework.session.enabled && !class_exists(FullStack::class) && interface_exists(CsrfTokenManagerInterface::class) + // defaults to (framework.csrf_protection.stateless_token_ids || framework.session.enabled) && !class_exists(FullStack::class) && interface_exists(CsrfTokenManagerInterface::class) ->scalarNode('enabled')->defaultNull()->end() ->arrayNode('stateless_token_ids') ->scalarPrototype()->end() diff --git a/DependencyInjection/FrameworkExtension.php b/DependencyInjection/FrameworkExtension.php index a7749cd30..26cae1f30 100644 --- a/DependencyInjection/FrameworkExtension.php +++ b/DependencyInjection/FrameworkExtension.php @@ -219,6 +219,10 @@ public function load(array $configs, ContainerBuilder $container): void throw new \LogicException('Requiring the "symfony/symfony" package is unsupported; replace it with standalone components instead.'); } + if (!ContainerBuilder::willBeAvailable('symfony/validator', Validation::class, ['symfony/framework-bundle', 'symfony/form'])) { + $container->setParameter('validator.translation_domain', 'validators'); + } + $loader->load('web.php'); $loader->load('services.php'); $loader->load('fragment_renderer.php'); @@ -462,9 +466,9 @@ public function load(array $configs, ContainerBuilder $container): void $container->removeDefinition('test.session.listener'); } - // csrf depends on session being registered + // csrf depends on session or stateless token ids being registered if (null === $config['csrf_protection']['enabled']) { - $this->writeConfigEnabled('csrf_protection', $config['csrf_protection']['stateless_token_ids'] || $this->readConfigEnabled('session', $container, $config['session']) && !class_exists(FullStack::class) && ContainerBuilder::willBeAvailable('symfony/security-csrf', CsrfTokenManagerInterface::class, ['symfony/framework-bundle']), $config['csrf_protection']); + $this->writeConfigEnabled('csrf_protection', ($config['csrf_protection']['stateless_token_ids'] || $this->readConfigEnabled('session', $container, $config['session'])) && !class_exists(FullStack::class) && ContainerBuilder::willBeAvailable('symfony/security-csrf', CsrfTokenManagerInterface::class, ['symfony/framework-bundle']), $config['csrf_protection']); } $this->registerSecurityCsrfConfiguration($config['csrf_protection'], $container, $loader); @@ -479,8 +483,6 @@ public function load(array $configs, ContainerBuilder $container): void if (ContainerBuilder::willBeAvailable('symfony/validator', Validation::class, ['symfony/framework-bundle', 'symfony/form'])) { $this->writeConfigEnabled('validation', true, $config['validation']); } else { - $container->setParameter('validator.translation_domain', 'validators'); - $container->removeDefinition('form.type_extension.form.validator'); $container->removeDefinition('form.type_guesser.validator'); } @@ -2396,11 +2398,6 @@ private function registerCacheConfiguration(array $config, ContainerBuilder $con ]; } foreach ($config['pools'] as $name => $pool) { - if (\in_array('cache.app', $pool['adapters'] ?? [], true) && $pool['tags']) { - trigger_deprecation('symfony/framework-bundle', '7.2', 'Using the "tags" option with the "cache.app" adapter is deprecated. You can use the "cache.app.taggable" adapter instead (aliased to the TagAwareCacheInterface for autowiring).'); - // throw new LogicException('The "tags" option cannot be used with the "cache.app" adapter. You can use the "cache.app.taggable" adapter instead (aliased to the TagAwareCacheInterface for autowiring).'); - } - $pool['adapters'] = $pool['adapters'] ?: ['cache.app']; $isRedisTagAware = ['cache.adapter.redis_tag_aware'] === $pool['adapters']; diff --git a/Tests/DependencyInjection/Fixtures/php/cache_cacheapp_tagaware.php b/Tests/DependencyInjection/Fixtures/php/cache_cacheapp_tagaware.php deleted file mode 100644 index 77606f5b1..000000000 --- a/Tests/DependencyInjection/Fixtures/php/cache_cacheapp_tagaware.php +++ /dev/null @@ -1,16 +0,0 @@ -loadFromExtension('framework', [ - 'annotations' => false, - 'http_method_override' => false, - 'handle_all_throwables' => true, - 'php_errors' => ['log' => true], - 'cache' => [ - 'pools' => [ - 'app.tagaware' => [ - 'adapter' => 'cache.app', - 'tags' => true, - ], - ], - ], -]); diff --git a/Tests/DependencyInjection/Fixtures/xml/cache_cacheapp_tagaware.xml b/Tests/DependencyInjection/Fixtures/xml/cache_cacheapp_tagaware.xml deleted file mode 100644 index 7d59e19d5..000000000 --- a/Tests/DependencyInjection/Fixtures/xml/cache_cacheapp_tagaware.xml +++ /dev/null @@ -1,15 +0,0 @@ - - - - - - - - - - - diff --git a/Tests/DependencyInjection/Fixtures/xml/form_csrf_disabled.xml b/Tests/DependencyInjection/Fixtures/xml/form_csrf_disabled.xml index ec97dcdd9..fdd02be87 100644 --- a/Tests/DependencyInjection/Fixtures/xml/form_csrf_disabled.xml +++ b/Tests/DependencyInjection/Fixtures/xml/form_csrf_disabled.xml @@ -12,7 +12,7 @@ - + diff --git a/Tests/DependencyInjection/Fixtures/xml/form_no_csrf.xml b/Tests/DependencyInjection/Fixtures/xml/form_no_csrf.xml index da8ed8b98..de1418108 100644 --- a/Tests/DependencyInjection/Fixtures/xml/form_no_csrf.xml +++ b/Tests/DependencyInjection/Fixtures/xml/form_no_csrf.xml @@ -9,7 +9,7 @@ - + diff --git a/Tests/DependencyInjection/Fixtures/yml/cache_cacheapp_tagaware.yml b/Tests/DependencyInjection/Fixtures/yml/cache_cacheapp_tagaware.yml deleted file mode 100644 index 32ef3d49c..000000000 --- a/Tests/DependencyInjection/Fixtures/yml/cache_cacheapp_tagaware.yml +++ /dev/null @@ -1,11 +0,0 @@ -framework: - annotations: false - http_method_override: false - handle_all_throwables: true - php_errors: - log: true - cache: - pools: - app.tagaware: - adapter: cache.app - tags: true diff --git a/Tests/DependencyInjection/FrameworkExtensionTestCase.php b/Tests/DependencyInjection/FrameworkExtensionTestCase.php index 016ae507b..798217191 100644 --- a/Tests/DependencyInjection/FrameworkExtensionTestCase.php +++ b/Tests/DependencyInjection/FrameworkExtensionTestCase.php @@ -13,7 +13,6 @@ use Psr\Cache\CacheItemPoolInterface; use Psr\Log\LoggerAwareInterface; -use Symfony\Bridge\PhpUnit\ExpectUserDeprecationMessageTrait; use Symfony\Bundle\FrameworkBundle\DependencyInjection\FrameworkExtension; use Symfony\Bundle\FrameworkBundle\FrameworkBundle; use Symfony\Bundle\FrameworkBundle\Tests\Fixtures\Messenger\DummyMessage; @@ -96,8 +95,6 @@ abstract class FrameworkExtensionTestCase extends TestCase { - use ExpectUserDeprecationMessageTrait; - private static array $containerCache = []; abstract protected function loadFromFile(ContainerBuilder $container, $file); @@ -1856,16 +1853,6 @@ public function testCacheTaggableTagAppliedToPools() } } - /** - * @group legacy - */ - public function testTaggableCacheAppIsDeprecated() - { - $this->expectUserDeprecationMessage('Since symfony/framework-bundle 7.2: Using the "tags" option with the "cache.app" adapter is deprecated. You can use the "cache.app.taggable" adapter instead (aliased to the TagAwareCacheInterface for autowiring).'); - - $this->createContainerFromFile('cache_cacheapp_tagaware'); - } - /** * @dataProvider appRedisTagAwareConfigProvider */ diff --git a/composer.json b/composer.json index b4f474bb9..9b3e7c86e 100644 --- a/composer.json +++ b/composer.json @@ -64,7 +64,7 @@ "symfony/string": "^6.4|^7.0", "symfony/translation": "^6.4|^7.0", "symfony/twig-bundle": "^6.4|^7.0", - "symfony/type-info": "^7.2", + "symfony/type-info": "^7.1", "symfony/validator": "^6.4|^7.0", "symfony/workflow": "^6.4|^7.0", "symfony/yaml": "^6.4|^7.0",