Skip to content

Commit ffdc268

Browse files
committed
Deprecate container params router.request_context.*
The `framework.router.default_uri` config is used to define the request context as fallback for the case that no HTTP request is available. But it does not affect the container params - `router.request_context.base_url` - `router.request_context.host` - `router.request_context.scheme` They still use the defaults, which are defined in the routing.php config file. This leads to inconsistency and confusion if a third party bundle relies on the container parameters instead of the request context service. This PR deprecates those container params like proposed in #53919.
1 parent 7ed3a4b commit ffdc268

File tree

3 files changed

+8
-0
lines changed

3 files changed

+8
-0
lines changed

UPGRADE-7.4.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,8 @@ FrameworkBundle
3333
---------------
3434

3535
* Deprecate `Symfony\Bundle\FrameworkBundle\Console\Application::add()` in favor of `addCommand()`
36+
* Deprecate the container params `router.request_context.scheme`, `router.request_context.host`
37+
and `router.request_context.base_url`, use the `framework.router.default_uri` config instead.
3638

3739
HtmlSanitizer
3840
-------------

src/Symfony/Bundle/FrameworkBundle/CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@ CHANGELOG
88
* Allow using their name without added suffix when using `#[Target]` for custom services
99
* Deprecate `Symfony\Bundle\FrameworkBundle\Console\Application::add()` in favor of `Symfony\Bundle\FrameworkBundle\Console\Application::addCommand()`
1010
* Add `assertEmailAddressNotContains()` to the `MailerAssertionsTrait`
11+
* Deprecate the container params `router.request_context.scheme`, `router.request_context.host`
12+
and `router.request_context.base_url`, use the `framework.router.default_uri` config instead.
1113

1214
7.3
1315
---

src/Symfony/Bundle/FrameworkBundle/DependencyInjection/FrameworkExtension.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1307,6 +1307,10 @@ private function registerRouterConfiguration(array $config, ContainerBuilder $co
13071307

13081308
$loader->load('routing.php');
13091309

1310+
$container->deprecateParameter('router.request_context.scheme', 'symfony/framework-bundle', '7.4', '"router.request_context.scheme" is deprecated, use the "framework.router.default_uri" config instead.');
1311+
$container->deprecateParameter('router.request_context.host', 'symfony/framework-bundle', '7.4', '"router.request_context.host" is deprecated, use the "framework.router.default_uri" config instead.');
1312+
$container->deprecateParameter('router.request_context.base_url', 'symfony/framework-bundle', '7.4', '"router.request_context.base_url" is deprecated, use the "framework.router.default_uri" config instead.');
1313+
13101314
if ($config['utf8']) {
13111315
$container->getDefinition('routing.loader')->replaceArgument(1, ['utf8' => true]);
13121316
}

0 commit comments

Comments
 (0)