feature #35310 [FrameworkBundle] Deprecate *not* setting the "framework.router.utf8" option (nicolas-grekas)
This PR was merged into the 5.1-dev branch.
Discussion
----------
[FrameworkBundle] Deprecate *not* setting the "framework.router.utf8" option
| Q | A
| ------------- | ---
| Branch? | master
| Bug fix? | no
| New feature? | no
| Deprecations? | yes
| Tickets | -
| License | MIT
| Doc PR | -
The goal here is to get rid of the `config/packages/routing.yaml` file in Symfony 6.
This should have no practical impact as all new apps already define this setting for 2 years.
Commits
-------
84849bc96a
[FrameworkBundle] Deprecate *not* setting the "framework.router.utf8" option
This commit is contained in:
commit
fa358e61e7
@ -10,6 +10,7 @@ FrameworkBundle
|
|||||||
---------------
|
---------------
|
||||||
|
|
||||||
* Deprecated passing a `RouteCollectionBuiler` to `MicroKernelTrait::configureRoutes()`, type-hint `RoutingConfigurator` instead
|
* 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
|
HttpFoundation
|
||||||
--------------
|
--------------
|
||||||
|
@ -10,6 +10,7 @@ FrameworkBundle
|
|||||||
---------------
|
---------------
|
||||||
|
|
||||||
* `MicroKernelTrait::configureRoutes()` is now always called with a `RoutingConfigurator`
|
* `MicroKernelTrait::configureRoutes()` is now always called with a `RoutingConfigurator`
|
||||||
|
* The "framework.router.utf8" configuration option defaults to `true`
|
||||||
|
|
||||||
HttpFoundation
|
HttpFoundation
|
||||||
--------------
|
--------------
|
||||||
|
@ -10,6 +10,7 @@ CHANGELOG
|
|||||||
* Added flex-compatible default implementations for `MicroKernelTrait::registerBundles()` and `getProjectDir()`
|
* Added flex-compatible default implementations for `MicroKernelTrait::registerBundles()` and `getProjectDir()`
|
||||||
* Deprecated passing a `RouteCollectionBuiler` to `MicroKernelTrait::configureRoutes()`, type-hint `RoutingConfigurator` instead
|
* Deprecated passing a `RouteCollectionBuiler` to `MicroKernelTrait::configureRoutes()`, type-hint `RoutingConfigurator` instead
|
||||||
* The `TemplateController` now accepts context argument
|
* 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
|
5.0.0
|
||||||
-----
|
-----
|
||||||
|
@ -481,7 +481,7 @@ class Configuration implements ConfigurationInterface
|
|||||||
)
|
)
|
||||||
->defaultTrue()
|
->defaultTrue()
|
||||||
->end()
|
->end()
|
||||||
->booleanNode('utf8')->defaultFalse()->end()
|
->booleanNode('utf8')->defaultNull()->end()
|
||||||
->arrayNode('context')
|
->arrayNode('context')
|
||||||
->info('The request context used to generate URLs in a non-HTTP context')
|
->info('The request context used to generate URLs in a non-HTTP context')
|
||||||
->addDefaultsIfNotSet()
|
->addDefaultsIfNotSet()
|
||||||
|
@ -838,6 +838,10 @@ class FrameworkExtension extends Extension
|
|||||||
|
|
||||||
$loader->load('routing.xml');
|
$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']) {
|
if ($config['utf8']) {
|
||||||
$container->getDefinition('routing.loader')->replaceArgument(1, ['utf8' => true]);
|
$container->getDefinition('routing.loader')->replaceArgument(1, ['utf8' => true]);
|
||||||
}
|
}
|
||||||
|
@ -412,7 +412,7 @@ class ConfigurationTest extends TestCase
|
|||||||
'http_port' => 80,
|
'http_port' => 80,
|
||||||
'https_port' => 443,
|
'https_port' => 443,
|
||||||
'strict_requirements' => true,
|
'strict_requirements' => true,
|
||||||
'utf8' => false,
|
'utf8' => null,
|
||||||
'context' => [
|
'context' => [
|
||||||
'host' => '%router.request_context.host%',
|
'host' => '%router.request_context.host%',
|
||||||
'scheme' => '%router.request_context.scheme%',
|
'scheme' => '%router.request_context.scheme%',
|
||||||
|
@ -23,6 +23,7 @@ $container->loadFromExtension('framework', [
|
|||||||
'router' => [
|
'router' => [
|
||||||
'resource' => '%kernel.project_dir%/config/routing.xml',
|
'resource' => '%kernel.project_dir%/config/routing.xml',
|
||||||
'type' => 'xml',
|
'type' => 'xml',
|
||||||
|
'utf8' => true,
|
||||||
],
|
],
|
||||||
'session' => [
|
'session' => [
|
||||||
'storage_id' => 'session.storage.native',
|
'storage_id' => 'session.storage.native',
|
||||||
|
@ -14,7 +14,7 @@
|
|||||||
<framework:esi enabled="true" />
|
<framework:esi enabled="true" />
|
||||||
<framework:ssi enabled="true" />
|
<framework:ssi enabled="true" />
|
||||||
<framework:profiler only-exceptions="true" enabled="false" />
|
<framework:profiler only-exceptions="true" enabled="false" />
|
||||||
<framework:router resource="%kernel.project_dir%/config/routing.xml" type="xml" />
|
<framework:router resource="%kernel.project_dir%/config/routing.xml" type="xml" utf8="true" />
|
||||||
<framework:session gc-maxlifetime="90000" gc-probability="1" gc-divisor="108" storage-id="session.storage.native" handler-id="session.handler.native_file" name="_SYMFONY" cookie-lifetime="86400" cookie-path="/" cookie-domain="example.com" cookie-secure="true" cookie-httponly="false" use-cookies="true" save-path="/path/to/sessions" sid-length="22" sid-bits-per-character="4" />
|
<framework:session gc-maxlifetime="90000" gc-probability="1" gc-divisor="108" storage-id="session.storage.native" handler-id="session.handler.native_file" name="_SYMFONY" cookie-lifetime="86400" cookie-path="/" cookie-domain="example.com" cookie-secure="true" cookie-httponly="false" use-cookies="true" save-path="/path/to/sessions" sid-length="22" sid-bits-per-character="4" />
|
||||||
<framework:request>
|
<framework:request>
|
||||||
<framework:format name="csv">
|
<framework:format name="csv">
|
||||||
|
@ -16,6 +16,7 @@ framework:
|
|||||||
router:
|
router:
|
||||||
resource: '%kernel.project_dir%/config/routing.xml'
|
resource: '%kernel.project_dir%/config/routing.xml'
|
||||||
type: xml
|
type: xml
|
||||||
|
utf8: true
|
||||||
session:
|
session:
|
||||||
storage_id: session.storage.native
|
storage_id: session.storage.native
|
||||||
handler_id: session.handler.native_file
|
handler_id: session.handler.native_file
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
framework:
|
framework:
|
||||||
secret: test
|
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 }
|
validation: { enabled: true, enable_annotations: true }
|
||||||
csrf_protection: true
|
csrf_protection: true
|
||||||
form: true
|
form: true
|
||||||
|
@ -91,6 +91,7 @@ class ConcreteMicroKernel extends Kernel implements EventSubscriberInterface
|
|||||||
$c->register('logger', NullLogger::class);
|
$c->register('logger', NullLogger::class);
|
||||||
$c->loadFromExtension('framework', [
|
$c->loadFromExtension('framework', [
|
||||||
'secret' => '$ecret',
|
'secret' => '$ecret',
|
||||||
|
'router' => ['utf8' => true],
|
||||||
]);
|
]);
|
||||||
|
|
||||||
$c->setParameter('halloween', 'Have a great day!');
|
$c->setParameter('halloween', 'Have a great day!');
|
||||||
|
@ -81,5 +81,7 @@ class FlexStyleMicroKernel extends Kernel
|
|||||||
->set('stdClass', 'stdClass')
|
->set('stdClass', 'stdClass')
|
||||||
->factory([$this, 'createHalloween'])
|
->factory([$this, 'createHalloween'])
|
||||||
->arg('$halloween', '%halloween%');
|
->arg('$halloween', '%halloween%');
|
||||||
|
|
||||||
|
$c->extension('framework', ['router' => ['utf8' => true]]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -140,7 +140,7 @@ class AddSessionDomainConstraintPassTest extends TestCase
|
|||||||
];
|
];
|
||||||
|
|
||||||
$ext = new FrameworkExtension();
|
$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 = new SecurityExtension();
|
||||||
$ext->load($config, $container);
|
$ext->load($config, $container);
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
framework:
|
framework:
|
||||||
secret: test
|
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 }
|
validation: { enabled: true, enable_annotations: true }
|
||||||
csrf_protection: true
|
csrf_protection: true
|
||||||
form: true
|
form: true
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
framework:
|
framework:
|
||||||
secret: test
|
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 }
|
validation: { enabled: true, enable_annotations: true }
|
||||||
csrf_protection: true
|
csrf_protection: true
|
||||||
form: true
|
form: true
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
framework:
|
framework:
|
||||||
secret: test
|
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: ~
|
test: ~
|
||||||
default_locale: en
|
default_locale: en
|
||||||
profiler: false
|
profiler: false
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
framework:
|
framework:
|
||||||
secret: test
|
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 }
|
validation: { enabled: true, enable_annotations: true }
|
||||||
assets: ~
|
assets: ~
|
||||||
csrf_protection: true
|
csrf_protection: true
|
||||||
|
@ -43,6 +43,7 @@ class WebProfilerBundleKernel extends Kernel
|
|||||||
'secret' => 'foo-secret',
|
'secret' => 'foo-secret',
|
||||||
'profiler' => ['only_exceptions' => false],
|
'profiler' => ['only_exceptions' => false],
|
||||||
'session' => ['storage_id' => 'session.storage.mock_file'],
|
'session' => ['storage_id' => 'session.storage.mock_file'],
|
||||||
|
'router' => ['utf8' => true],
|
||||||
]);
|
]);
|
||||||
|
|
||||||
$containerBuilder->loadFromExtension('web_profiler', [
|
$containerBuilder->loadFromExtension('web_profiler', [
|
||||||
|
Reference in New Issue
Block a user