-
-
Notifications
You must be signed in to change notification settings - Fork 9.7k
[FrameworkBundle] Deprecate container parameters router.request_context.scheme and .host #61457
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: 7.4
Are you sure you want to change the base?
[FrameworkBundle] Deprecate container parameters router.request_context.scheme and .host #61457
Conversation
3b8c492
to
6aad228
Compare
6aad228
to
ec2dade
Compare
This is not marking the parameters as deprecated to warn places using them. |
You mean that the |
I mean actually deprecating the parameters: https://symfony.com/blog/new-in-symfony-6-3-dependency-injection-improvements#deprecating-container-parameters |
ec2dade
to
ffdc268
Compare
Thanks for the hint. I have updated the patch. |
I wouldn't deprecate --- a/src/Symfony/Bundle/FrameworkBundle/DependencyInjection/FrameworkExtension.php
+++ b/src/Symfony/Bundle/FrameworkBundle/DependencyInjection/FrameworkExtension.php
@@ -1334,8 +1334,7 @@ class FrameworkExtension extends Extension
$container->setParameter('request_listener.https_port', $config['https_port']);
if (null !== $config['default_uri']) {
- $container->getDefinition('router.request_context')
- ->replaceArgument(0, $config['default_uri']);
+ $container->setParameter('router.request_context.base_url', $config['default_uri']);
}
} |
Wouldn't this be a potential source of confusion? If a user sets And what would be the advantage? |
The advantage is not breaking things (deprecating first but still) and allowing bundles to read the value also. |
Historically the Imho overwriting the base_url with the default_uri, which is always an absolute URI containing scheme and host, could lead to a hidden BC break. |
This was later improved to support full URI, see #36651 |
ffdc268
to
3493bcc
Compare
Okay, I have applied your suggestion ;-) |
3493bcc
to
01ec276
Compare
src/Symfony/Bundle/FrameworkBundle/DependencyInjection/FrameworkExtension.php
Outdated
Show resolved
Hide resolved
…xt.scheme and .host
01ec276
to
8034510
Compare
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 paramsrouter.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.