From 84849bc96a24a3a91ea30817f11504c62c00f275 Mon Sep 17 00:00:00 2001 From: Nicolas Grekas Date: Sat, 11 Jan 2020 19:12:40 +0100 Subject: [PATCH] [FrameworkBundle] Deprecate *not* setting the "framework.router.utf8" option --- UPGRADE-5.1.md | 1 + UPGRADE-6.0.md | 1 + src/Symfony/Bundle/FrameworkBundle/CHANGELOG.md | 1 + .../FrameworkBundle/DependencyInjection/Configuration.php | 2 +- .../DependencyInjection/FrameworkExtension.php | 4 ++++ .../Tests/DependencyInjection/ConfigurationTest.php | 2 +- .../Tests/DependencyInjection/Fixtures/php/full.php | 1 + .../Tests/DependencyInjection/Fixtures/xml/full.xml | 2 +- .../Tests/DependencyInjection/Fixtures/yml/full.yml | 1 + .../FrameworkBundle/Tests/Functional/app/config/framework.yml | 2 +- .../FrameworkBundle/Tests/Kernel/ConcreteMicroKernel.php | 1 + .../Tests/Kernel/flex-style/src/FlexStyleMicroKernel.php | 2 ++ .../Compiler/AddSessionDomainConstraintPassTest.php | 2 +- .../SecurityBundle/Tests/Functional/app/Anonymous/config.yml | 2 +- .../Tests/Functional/app/FirewallEntryPoint/config.yml | 2 +- .../SecurityBundle/Tests/Functional/app/Guarded/config.yml | 2 +- .../SecurityBundle/Tests/Functional/app/config/framework.yml | 2 +- .../Tests/Functional/WebProfilerBundleKernel.php | 1 + 18 files changed, 22 insertions(+), 9 deletions(-) diff --git a/UPGRADE-5.1.md b/UPGRADE-5.1.md index afa2f217ef430..6a0244b9b8eb5 100644 --- a/UPGRADE-5.1.md +++ b/UPGRADE-5.1.md @@ -10,6 +10,7 @@ FrameworkBundle --------------- * Deprecated passing a `RouteCollectionBuiler` to `MicroKernelTrait::configureRoutes()`, type-hint `RoutingConfigurator` instead + * Deprecated *not* setting the "framework.router.utf8" configuration option as it will default to `true` in Symfony 6.0 HttpFoundation -------------- diff --git a/UPGRADE-6.0.md b/UPGRADE-6.0.md index 31b749f65db4e..f23602c7bd237 100644 --- a/UPGRADE-6.0.md +++ b/UPGRADE-6.0.md @@ -10,6 +10,7 @@ FrameworkBundle --------------- * `MicroKernelTrait::configureRoutes()` is now always called with a `RoutingConfigurator` + * The "framework.router.utf8" configuration option defaults to `true` HttpFoundation -------------- diff --git a/src/Symfony/Bundle/FrameworkBundle/CHANGELOG.md b/src/Symfony/Bundle/FrameworkBundle/CHANGELOG.md index 9a78822a338cd..5b3dfdc2ba319 100644 --- a/src/Symfony/Bundle/FrameworkBundle/CHANGELOG.md +++ b/src/Symfony/Bundle/FrameworkBundle/CHANGELOG.md @@ -9,6 +9,7 @@ CHANGELOG * Added flex-compatible default implementations for `MicroKernelTrait::registerBundles()` and `getProjectDir()` * Deprecated passing a `RouteCollectionBuiler` to `MicroKernelTrait::configureRoutes()`, type-hint `RoutingConfigurator` instead * The `TemplateController` now accepts context argument + * Deprecated *not* setting the "framework.router.utf8" configuration option as it will default to `true` in Symfony 6.0 5.0.0 ----- diff --git a/src/Symfony/Bundle/FrameworkBundle/DependencyInjection/Configuration.php b/src/Symfony/Bundle/FrameworkBundle/DependencyInjection/Configuration.php index 8224e0a56bc05..52fddbf2f3446 100644 --- a/src/Symfony/Bundle/FrameworkBundle/DependencyInjection/Configuration.php +++ b/src/Symfony/Bundle/FrameworkBundle/DependencyInjection/Configuration.php @@ -481,7 +481,7 @@ private function addRouterSection(ArrayNodeDefinition $rootNode) ) ->defaultTrue() ->end() - ->booleanNode('utf8')->defaultFalse()->end() + ->booleanNode('utf8')->defaultNull()->end() ->arrayNode('context') ->info('router request context') ->addDefaultsIfNotSet() diff --git a/src/Symfony/Bundle/FrameworkBundle/DependencyInjection/FrameworkExtension.php b/src/Symfony/Bundle/FrameworkBundle/DependencyInjection/FrameworkExtension.php index 45fd20a1153f3..6261ec862459e 100644 --- a/src/Symfony/Bundle/FrameworkBundle/DependencyInjection/FrameworkExtension.php +++ b/src/Symfony/Bundle/FrameworkBundle/DependencyInjection/FrameworkExtension.php @@ -838,6 +838,10 @@ private function registerRouterConfiguration(array $config, ContainerBuilder $co $loader->load('routing.xml'); + if (null === $config['utf8']) { + @trigger_error('Not setting the "framework.router.utf8" configuration option is deprecated since Symfony 5.1, it will default to "true" in Symfony 6.0.', E_USER_DEPRECATED); + } + if ($config['utf8']) { $container->getDefinition('routing.loader')->replaceArgument(1, ['utf8' => true]); } diff --git a/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/ConfigurationTest.php b/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/ConfigurationTest.php index 3d6840d6e602e..7e3d096180e34 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/ConfigurationTest.php +++ b/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/ConfigurationTest.php @@ -412,7 +412,7 @@ protected static function getBundleDefaultConfig() 'http_port' => 80, 'https_port' => 443, 'strict_requirements' => true, - 'utf8' => false, + 'utf8' => null, 'context' => [ 'host' => '%router.request_context.host%', 'scheme' => '%router.request_context.scheme%', diff --git a/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Fixtures/php/full.php b/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Fixtures/php/full.php index e633d34187cf9..813b51541e38a 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Fixtures/php/full.php +++ b/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Fixtures/php/full.php @@ -23,6 +23,7 @@ 'router' => [ 'resource' => '%kernel.project_dir%/config/routing.xml', 'type' => 'xml', + 'utf8' => true, ], 'session' => [ 'storage_id' => 'session.storage.native', diff --git a/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Fixtures/xml/full.xml b/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Fixtures/xml/full.xml index 8c4c489ea3430..aaeeba580a268 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Fixtures/xml/full.xml +++ b/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Fixtures/xml/full.xml @@ -14,7 +14,7 @@ - + diff --git a/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Fixtures/yml/full.yml b/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Fixtures/yml/full.yml index a189f992daf34..fff49e7528180 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Fixtures/yml/full.yml +++ b/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Fixtures/yml/full.yml @@ -16,6 +16,7 @@ framework: router: resource: '%kernel.project_dir%/config/routing.xml' type: xml + utf8: true session: storage_id: session.storage.native handler_id: session.handler.native_file diff --git a/src/Symfony/Bundle/FrameworkBundle/Tests/Functional/app/config/framework.yml b/src/Symfony/Bundle/FrameworkBundle/Tests/Functional/app/config/framework.yml index 040708e011a60..1c42894a24d9c 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Tests/Functional/app/config/framework.yml +++ b/src/Symfony/Bundle/FrameworkBundle/Tests/Functional/app/config/framework.yml @@ -1,6 +1,6 @@ framework: secret: test - router: { resource: "%kernel.project_dir%/%kernel.test_case%/routing.yml" } + router: { resource: "%kernel.project_dir%/%kernel.test_case%/routing.yml", utf8: true } validation: { enabled: true, enable_annotations: true } csrf_protection: true form: true diff --git a/src/Symfony/Bundle/FrameworkBundle/Tests/Kernel/ConcreteMicroKernel.php b/src/Symfony/Bundle/FrameworkBundle/Tests/Kernel/ConcreteMicroKernel.php index c5da350a278f6..2cab4749d3816 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Tests/Kernel/ConcreteMicroKernel.php +++ b/src/Symfony/Bundle/FrameworkBundle/Tests/Kernel/ConcreteMicroKernel.php @@ -91,6 +91,7 @@ protected function configureContainer(ContainerBuilder $c, LoaderInterface $load $c->register('logger', NullLogger::class); $c->loadFromExtension('framework', [ 'secret' => '$ecret', + 'router' => ['utf8' => true], ]); $c->setParameter('halloween', 'Have a great day!'); diff --git a/src/Symfony/Bundle/FrameworkBundle/Tests/Kernel/flex-style/src/FlexStyleMicroKernel.php b/src/Symfony/Bundle/FrameworkBundle/Tests/Kernel/flex-style/src/FlexStyleMicroKernel.php index 016c66f612c2b..e4e0a2777404f 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Tests/Kernel/flex-style/src/FlexStyleMicroKernel.php +++ b/src/Symfony/Bundle/FrameworkBundle/Tests/Kernel/flex-style/src/FlexStyleMicroKernel.php @@ -81,5 +81,7 @@ protected function configureContainer(ContainerConfigurator $c) ->set('stdClass', 'stdClass') ->factory([$this, 'createHalloween']) ->arg('$halloween', '%halloween%'); + + $c->extension('framework', ['router' => ['utf8' => true]]); } } diff --git a/src/Symfony/Bundle/SecurityBundle/Tests/DependencyInjection/Compiler/AddSessionDomainConstraintPassTest.php b/src/Symfony/Bundle/SecurityBundle/Tests/DependencyInjection/Compiler/AddSessionDomainConstraintPassTest.php index 8b9f59dbd9e3b..438a2072ef181 100644 --- a/src/Symfony/Bundle/SecurityBundle/Tests/DependencyInjection/Compiler/AddSessionDomainConstraintPassTest.php +++ b/src/Symfony/Bundle/SecurityBundle/Tests/DependencyInjection/Compiler/AddSessionDomainConstraintPassTest.php @@ -140,7 +140,7 @@ private function createContainer($sessionStorageOptions) ]; $ext = new FrameworkExtension(); - $ext->load(['framework' => ['csrf_protection' => false, 'router' => ['resource' => 'dummy']]], $container); + $ext->load(['framework' => ['csrf_protection' => false, 'router' => ['resource' => 'dummy', 'utf8' => true]]], $container); $ext = new SecurityExtension(); $ext->load($config, $container); diff --git a/src/Symfony/Bundle/SecurityBundle/Tests/Functional/app/Anonymous/config.yml b/src/Symfony/Bundle/SecurityBundle/Tests/Functional/app/Anonymous/config.yml index 8ee417ab3a17d..c0f9a7c19115f 100644 --- a/src/Symfony/Bundle/SecurityBundle/Tests/Functional/app/Anonymous/config.yml +++ b/src/Symfony/Bundle/SecurityBundle/Tests/Functional/app/Anonymous/config.yml @@ -1,6 +1,6 @@ framework: secret: test - router: { resource: "%kernel.project_dir%/%kernel.test_case%/routing.yml" } + router: { resource: "%kernel.project_dir%/%kernel.test_case%/routing.yml", utf8: true } validation: { enabled: true, enable_annotations: true } csrf_protection: true form: true diff --git a/src/Symfony/Bundle/SecurityBundle/Tests/Functional/app/FirewallEntryPoint/config.yml b/src/Symfony/Bundle/SecurityBundle/Tests/Functional/app/FirewallEntryPoint/config.yml index ae33d776e43fe..43bb399bce6ab 100644 --- a/src/Symfony/Bundle/SecurityBundle/Tests/Functional/app/FirewallEntryPoint/config.yml +++ b/src/Symfony/Bundle/SecurityBundle/Tests/Functional/app/FirewallEntryPoint/config.yml @@ -1,6 +1,6 @@ framework: secret: test - router: { resource: "%kernel.project_dir%/%kernel.test_case%/routing.yml" } + router: { resource: "%kernel.project_dir%/%kernel.test_case%/routing.yml", utf8: true } validation: { enabled: true, enable_annotations: true } csrf_protection: true form: true diff --git a/src/Symfony/Bundle/SecurityBundle/Tests/Functional/app/Guarded/config.yml b/src/Symfony/Bundle/SecurityBundle/Tests/Functional/app/Guarded/config.yml index 2d1f779a530ec..f9445486a4913 100644 --- a/src/Symfony/Bundle/SecurityBundle/Tests/Functional/app/Guarded/config.yml +++ b/src/Symfony/Bundle/SecurityBundle/Tests/Functional/app/Guarded/config.yml @@ -1,6 +1,6 @@ framework: secret: test - router: { resource: "%kernel.project_dir%/%kernel.test_case%/routing.yml" } + router: { resource: "%kernel.project_dir%/%kernel.test_case%/routing.yml", utf8: true } test: ~ default_locale: en profiler: false diff --git a/src/Symfony/Bundle/SecurityBundle/Tests/Functional/app/config/framework.yml b/src/Symfony/Bundle/SecurityBundle/Tests/Functional/app/config/framework.yml index a6ee6533e8100..3c60329efb3f1 100644 --- a/src/Symfony/Bundle/SecurityBundle/Tests/Functional/app/config/framework.yml +++ b/src/Symfony/Bundle/SecurityBundle/Tests/Functional/app/config/framework.yml @@ -1,6 +1,6 @@ framework: secret: test - router: { resource: "%kernel.project_dir%/%kernel.test_case%/routing.yml" } + router: { resource: "%kernel.project_dir%/%kernel.test_case%/routing.yml", utf8: true } validation: { enabled: true, enable_annotations: true } assets: ~ csrf_protection: true diff --git a/src/Symfony/Bundle/WebProfilerBundle/Tests/Functional/WebProfilerBundleKernel.php b/src/Symfony/Bundle/WebProfilerBundle/Tests/Functional/WebProfilerBundleKernel.php index 4cf8d41e4dc6d..76c224d0777fe 100644 --- a/src/Symfony/Bundle/WebProfilerBundle/Tests/Functional/WebProfilerBundleKernel.php +++ b/src/Symfony/Bundle/WebProfilerBundle/Tests/Functional/WebProfilerBundleKernel.php @@ -43,6 +43,7 @@ protected function configureContainer(ContainerBuilder $containerBuilder, Loader 'secret' => 'foo-secret', 'profiler' => ['only_exceptions' => false], 'session' => ['storage_id' => 'session.storage.mock_file'], + 'router' => ['utf8' => true], ]); $containerBuilder->loadFromExtension('web_profiler', [ pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy