8000 [FrameworkBundle] Remove config deprecations · symfony/symfony@9a05727 · GitHub
[go: up one dir, main page]

Skip to content

Commit 9a05727

Browse files
[FrameworkBundle] Remove config deprecations
1 parent 8964e6a commit 9a05727

File tree

4 files changed

+42
-85
lines changed

4 files changed

+42
-85
lines changed

UPGRADE-7.0.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -202,6 +202,15 @@ FrameworkBundle
202202
* Remove the integration of Doctrine annotations, use native attributes instead
203203
* Remove `EnableLoggerDebugModePass`, use argument `$debug` of HttpKernel's `Logger` instead
204204
* Remove `AddDebugLogProcessorPass::configureLogger()`, use HttpKernel's `DebugLoggerConfigurator` instead
205+
* Make the `framework.handle_all_throwables` config option default to `true`
206+
* Make the `framework.php_errors.log` config option default to `true`
207+
* Make the `framework.session.cookie_secure` config option default to `auto`
208+
* Make the `framework.session.cookie_samesite` config option default to `lax`
209+
* Make the `framework.session.save_path` config option default to `null`
210+
* Make the `framework.session.handler_id` config option default to `session.handler.native_file` when `framework.session.save_path` is set or `null` otherwise
211+
* Make the `framework.uid.default_uuid_version` config option default to `7`
212+
* Make the `framework.uid.time_based_uuid_version` config option default to `7`
213+
* Make the `framework.validation.email_validation_mode` config option default to `html5`
205214

206215
HttpFoundation
207216
--------------

src/Symfony/Bundle/FrameworkBundle/CHANGELOG.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,15 @@ CHANGELOG
1414
* Remove the integration of Doctrine annotations, use native attributes instead
1515
* Remove `EnableLoggerDebugModePass`, use argument `$debug` of HttpKernel's `Logger` instead
1616
* Remove `AddDebugLogProcessorPass::configureLogger()`, use HttpKernel's `DebugLoggerConfigurator` instead
17+
* Make the `framework.handle_all_throwables` config option default to `true`
18+
* Make the `framework.php_errors.log` config option default to `true`
19+
* Make the `framework.session.cookie_secure` config option default to `auto`
20+
* Make the `framework.session.cookie_samesite` config option default to `lax`
21+
* Make the `framework.session.save_path` config option default to `null`
22+
* Make the `framework.session.handler_id` config option default to `session.handler.native_file` when `framework.session.save_path` is set or `null` otherwise
23+
* Make the `framework.uid.default_uuid_version` config option default to `7`
24+
* Make the `framework.uid.time_based_uuid_version` config option default to `7`
25+
* Make the `framework.validation.email_validation_mode` config option default to `html5`
1726

1827
6.4
1928
---

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

Lines changed: 17 additions & 80 deletions
Original file line numberDiff line numberDiff line change
@@ -82,15 +82,6 @@ public function getConfigTreeBuilder(): TreeBuilder
8282
return $v;
8383
})
8484
->end()
85-
->validate()
86-
->always(function ($v) {
87-
if (!isset($v['handle_all_throwables'])) {
88-
trigger_deprecation('symfony/framework-bundle', '6.4', 'Not setting the "framework.handle_all_throwables" config option is deprecated. It will default to "true" in 7.0.');
89-
}
90-
91-
return $v;
92-
})
93-
->end()
9485
->fixXmlConfig('enabled_locale')
9586
->children()
9687
->scalarNode('secret')->end()
@@ -137,7 +128,7 @@ public function getConfigTreeBuilder(): TreeBuilder
137128
->scalarNode('error_controller')
138129
->defaultValue('error_controller')
139130
->end()
140-
->booleanNode('handle_all_throwables')->info('HttpKernel will handle all kinds of \Throwable')->end()
131+
->booleanNode('handle_all_throwables')->info('HttpKernel will handle all kinds of \Throwable')->defaultTrue()->end()
141132
->end()
142133
;
143134

@@ -649,35 +640,6 @@ private function addRouterSection(ArrayNodeDefinition $rootNode): void
649640
private function addSessionSection(ArrayNodeDefinition $rootNode): void
650641
{
651642
$rootNode
652-
->validate()
653-
->always(function (array $v): array {
654-
if ($v['session']['enabled']) {
655-
if (!\array_key_exists('cookie_secure', $v['session'])) {
656-
trigger_deprecation('symfony/framework-bundle', '6.4', 'Not setting the "framework.session.cookie_secure" config option is deprecated. It will default to "auto" in 7.0.');
657-
}
658-
659-
if (!\array_key_exists('cookie_samesite', $v['session'])) {
660-
trigger_deprecation('symfony/framework-bundle', '6.4', 'Not setting the "framework.session.cookie_samesite" config option is deprecated. It will default to "lax" in 7.0.');
661-
}
662-
663-
if (!\array_key_exists('handler_id', $v['session'])) {
664-
if (!\array_key_exists('save_path', $v['session'])) {
665-
trigger_deprecation('symfony/framework-bundle', '6.4', 'Not setting the "framework.session.save_path" config option when the "framework.session.handler_id" config option is not set either is deprecated. Both options will default to "null" in 7.0.');
666-
} else {
667-
trigger_deprecation('symfony/framework-bundle', '6.4', 'Not setting the "framework.session.handler_id" config option is deprecated. It will default to "session.handler.native_file" when "framework.session.save_path" is set or "null" otherwise in 7.0.');
668-
}
669-
}
670-
}
671-
672-
$v['session'] += [
673-
'cookie_samesite' => null,
674-
'handler_id' => 'session.handler.native_file',
675-
'save_path' => '%kernel.cache_dir%/sessions',
676-
];
677-
678-
return $v;
679-
})
680-
->end()
681643
->children()
682644
->arrayNode('session')
683645
->info('session configuration')
@@ -698,14 +660,14 @@ private function addSessionSection(ArrayNodeDefinition $rootNode): void
698660
->scalarNode('cookie_lifetime')->end()
699661
->scalarNode('cookie_path')->end()
700662
->scalarNode('cookie_domain')->end()
701-
->enumNode('cookie_secure')->values([true, false, 'auto'])->end()
663+
->enumNode('cookie_secure')->values([true, false, 'auto'])->defaultValue('auto')->end()
702664
->booleanNode('cookie_httponly')->defaultTrue()->end()
703-
->enumNode('cookie_samesite')->values([null, Cookie::SAMESITE_LAX, Cookie::SAMESITE_STRICT, Cookie::SAMESITE_NONE])->end()
665+
->enumNode('cookie_samesite')->values([null, Cookie::SAMESITE_LAX, Cookie::SAMESITE_STRICT, Cookie::SAMESITE_NONE])->defaultValue('lax')->end()
704666
->booleanNode('use_cookies')->end()
705667
->scalarNode('gc_divisor')->end()
706668
->scalarNode('gc_probability')->defaultValue(1)->end()
707669
->scalarNode('gc_maxlifetime')->end()
708-
->scalarNode('save_path')->end()
670+
->scalarNode('save_path')->defaultNull()->end()
709671
->integerNode('metadata_update_threshold')
710672
->defaultValue(0)
711673
->info('seconds to wait between 2 session metadata updates')
@@ -721,6 +683,15 @@ private function addSessionSection(ArrayNodeDefinition $rootNode): void
721683
->end()
722684
->end()
723685
->end()
686+
->validate()
687+
->always(function (array $v): array {
688+
if (!\array_key_exists('handler_id', $v['session'])) {
689+
$v['session']['handler_id'] = $v['session']['save_path'] ? 'session.handler.native_file' : null;
690+
}
691+
692+
return $v;
693+
})
694+
->end()
724695
;
725696
}
726697

@@ -1017,15 +988,6 @@ private function addTranslatorSection(ArrayNodeDefinition $rootNode, callable $e
1017988
private function addValidationSection(ArrayNodeDefinition $rootNode, callable $enableIfStandalone): void
1018989
{
1019990
$rootNode
1020-
->validate()
1021-
->always(function ($v) {
1022-
if ($v['validation']['enabled'] && !\array_key_exists('email_validation_mode', $v['validation'])) {
1023-
trigger_deprecation('symfony/framework-bundle', '6.4', 'Not setting the "framework.validation.email_validation_mode" config option is deprecated. It will default to "html5" in 7.0.');
1024-
}
1025-
1026-
return $v;
1027-
})
1028-
->end()
1029991
->children()
1030992
->arrayNode('validation')
1031993
->info('validation configuration')
@@ -1040,7 +1002,7 @@ private function addValidationSection(ArrayNodeDefinition $rootNode, callable $e
10401002
->validate()->castToArray()->end()
10411003
->end()
10421004
->scalarNode('translation_domain')->defaultValue('validators')->end()
1043-
->enumNode('email_validation_mode')->values(['html5', 'loose', 'strict'])->end()
1005+
->enumNode('email_validation_mode')->values(['html5', 'loose', 'strict'])->defaultValue('html5')->end()
10441006
->arrayNode('mapping')
10451007
->addDefaultsIfNotSet()
10461008
->fixXmlConfig('path')
@@ -1290,17 +1252,6 @@ private function addCacheSection(ArrayNodeDefinition $rootNode, callable $willBe
12901252
private function addPhpErrorsSection(ArrayNodeDefinition $rootNode): void
12911253
{
12921254
$rootNode
1293-
->validate()
1294-
->always(function (array $v): array {
1295-
if (!\array_key_exists('log', $v['php_errors'])) {
1296-
trigger_deprecation('symfony/framework-bundle', '6.4', 'Not setting the "framework.php_errors.log" config option is deprecated. It will default to "true" in 7.0.');
1297-
1298-
$v['php_errors']['log'] = $this->debug;
1299-
}
1300-
1301-
return $v;
1302-
})
1303-
->end()
13041255
->children()
13051256
->arrayNode('php_errors')
13061257
->info('PHP errors handling configuration')
@@ -1310,6 +1261,7 @@ private function addPhpErrorsSection(ArrayNodeDefinition $rootNode): void
13101261
->info('Use the application logger instead of the PHP logger for logging PHP errors.')
13111262
->example('"true" to use the default configuration: log all errors. "false" to disable. An integer bit field of E_* constants, or an array mapping E_* constants to log levels.')
13121263
->treatNullLike($this->debug)
1264+
->defaultTrue()
13131265
->beforeNormalization()
13141266
->ifArray()
13151267
->then(function (array $v): array {
@@ -2322,23 +2274,6 @@ private function addRateLimiterSection(ArrayNodeDefinition $rootNode, callable $
23222274
private function addUidSection(ArrayNodeDefinition $rootNode, callable $enableIfStandalone): void
23232275
{
23242276
$rootNode
2325-
->validate()
2326-
->always(function ($v) {
2327-
if ($v['uid']['enabled']) {
2328-
if (!\array_key_exists('default_uuid_version', $v['uid'])) {
2329-
trigger_deprecation('symfony/framework-bundle', '6.4', 'Not setting the "framework.uid.default_uuid_version" config option is deprecated. It will default to "7" in 7.0.');
2330-
}
2331-
2332-
if (!\array_key_exists('time_based_uuid_version', $v['uid'])) {
2333-
trigger_deprecation('symfony/framework-bundle', '6.4', 'Not setting the "framework.uid.time_based_uuid_version" config option is deprecated. It will default to "7" in 7.0.');
2334-
}
2335-
}
2336-
2337-
$v['uid'] += ['default_uuid_version' => 6, 'time_based_uuid_version' => 6];
2338-
2339-
return $v;
2340-
})
2341-
->end()
23422277
->children()
23432278
->arrayNode('uid')
23442279
->info('Uid configuration')
@@ -2347,6 +2282,7 @@ private function addUidSection(ArrayNodeDefinition $rootNode, callable $enableIf
23472282
->children()
23482283
->enumNode('default_uuid_version')
23492284
->values([7, 6, 4, 1])
2285+
->defaultValue(7)
23502286
->end()
23512287
->enumNode('name_based_uuid_version')
23522288
->defaultValue(5)
@@ -2357,6 +2293,7 @@ private function addUidSection(ArrayNodeDefinition $rootNode, callable $enableIf
23572293
->end()
23582294
->enumNode('time_based_uuid_version')
23592295
->values([7, 6, 1])
2296+
->defaultValue(7)
23602297
->end()
23612298
->scalarNode('time_based_uuid_node')
23622299
->cannotBeEmpty()

src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/ConfigurationTest.php

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -602,6 +602,7 @@ protected static function getBundleDefaultConfig()
602602
'enabled' => true,
603603
'endpoint' => null,
604604
],
605+
'email_validation_mode' => 'html5',
605606
],
606607
'annotations' => [
607608
'enabled' => false,
@@ -635,11 +636,12 @@ protected static function getBundleDefaultConfig()
635636
'session' => [
636637
'enabled' => false,
637638
'storage_factory_id' => 'session.storage.factory.native',
638-
'handler_id' => 'session.handler.native_file',
639+
'handler_id' => null,
639640
'cookie_httponly' => true,
640-
'cookie_samesite' => null,
641+
'cookie_samesite' => 'lax',
642+
'cookie_secure' => 'auto',
641643
'gc_probability' => 1,
642-
'save_path' => '%kernel.cache_dir%/sessions',
644+
'save_path' => null,
643645
'metadata_update_threshold' => 0,
644646
],
645647
'request' => [
@@ -762,9 +764,9 @@ class_exists(SemaphoreStore::class) && SemaphoreStore::isSupported() ? 'semaphor
762764
],
763765
'uid' => [
764766
'enabled' => !class_exists(FullStack::class) && class_exists(UuidFactory::class),
765-
'default_uuid_version' => 6,
767+
'default_uuid_version' => 7,
766768
'name_based_uuid_version' => 5,
767-
'time_based_uuid_version' => 6,
769+
'time_based_uuid_version' => 7,
768770
],
769771
'html_sanitizer' => [
770772
'enabled' => !class_exists(FullStack::class) && class_exists(HtmlSanitizer::class),

0 commit comments

Comments
 (0)
0