Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit5ce5bac

Browse files
[FrameworkBundle] Remove config deprecations
1 parent52e98e2 commit5ce5bac

File tree

5 files changed

+44
-98
lines changed

5 files changed

+44
-98
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`%kernel.cache_dir%/sessions` when`framework.session.handler_id` is set or`null` otherwise
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`%kernel.cache_dir%/sessions` when`framework.session.handler_id` is set or`null` otherwise
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: 13 additions & 91 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,42 +640,15 @@ private function addRouterSection(ArrayNodeDefinition $rootNode): void
649640
privatefunctionaddSessionSection(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')
684646
->canBeEnabled()
685647
->children()
686648
->scalarNode('storage_factory_id')->defaultValue('session.storage.factory.native')->end()
687-
->scalarNode('handler_id')->end()
649+
->scalarNode('handler_id')
650+
->info('Defaults to using the native session handler, or to the native *file* session handler if "save_path" is not null.')
651+
->end()
688652
->scalarNode('name')
689653
->validate()
690654
->ifTrue(function ($v) {
@@ -698,14 +662,16 @@ private function addSessionSection(ArrayNodeDefinition $rootNode): void
698662
->scalarNode('cookie_lifetime')->end()
699663
->scalarNode('cookie_path')->end()
700664
->scalarNode('cookie_domain')->end()
701-
->enumNode('cookie_secure')->values([true,false,'auto'])->end()
665+
->enumNode('cookie_secure')->values([true,false,'auto'])->defaultValue('auto')->end()
702666
->booleanNode('cookie_httponly')->defaultTrue()->end()
703-
->enumNode('cookie_samesite')->values([null, Cookie::SAMESITE_LAX, Cookie::SAMESITE_STRICT, Cookie::SAMESITE_NONE])->end()
667+
->enumNode('cookie_samesite')->values([null, Cookie::SAMESITE_LAX, Cookie::SAMESITE_STRICT, Cookie::SAMESITE_NONE])->defaultValue('lax')->end()
704668
->booleanNode('use_cookies')->end()
705669
->scalarNode('gc_divisor')->end()
706670
->scalarNode('gc_probability')->defaultValue(1)->end()
707671
->scalarNode('gc_maxlifetime')->end()
708-
->scalarNode('save_path')->end()
672+
->scalarNode('save_path')
673+
->info('Defaults to "%kernel.cache_dir%/sessions" if the "handler_id" option is not null')
674+
->end()
709675
->integerNode('metadata_update_threshold')
710676
->defaultValue(0)
711677
->info('seconds to wait between 2 session metadata updates')
@@ -1017,25 +983,6 @@ private function addTranslatorSection(ArrayNodeDefinition $rootNode, callable $e
1017983
privatefunctionaddValidationSection(ArrayNodeDefinition$rootNode,callable$enableIfStandalone):void
1018984
{
1019985
$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-
if (isset($v['enable_annotations'])) {
1027-
trigger_deprecation('symfony/framework-bundle','6.4','Option "enable_annotations" at "framework.validation" is deprecated. Use the "enable_attributes" option instead.');
1028-
1029-
if (!isset($v['enable_attributes'])) {
1030-
$v['enable_attributes'] =$v['enable_annotations'];
1031-
}else {
1032-
thrownewLogicException('The "enable_annotations" and "enable_attributes" options at path "framework.validation" must not be both set. Only the "enable_attributes" option must be used.');
1033-
}
1034-
}
1035-
1036-
return$v;
1037-
})
1038-
->end()
1039986
->children()
1040987
->arrayNode('validation')
1041988
->info('validation configuration')
@@ -1051,7 +998,7 @@ private function addValidationSection(ArrayNodeDefinition $rootNode, callable $e
1051998
->validate()->castToArray()->end()
1052999
->end()
10531000
->scalarNode('translation_domain')->defaultValue('validators')->end()
1054-
->enumNode('email_validation_mode')->values(['html5','loose','strict'])->end()
1001+
->enumNode('email_validation_mode')->values(['html5','loose','strict'])->defaultValue('html5')->end()
10551002
->arrayNode('mapping')
10561003
->addDefaultsIfNotSet()
10571004
->fixXmlConfig('path')
@@ -1316,17 +1263,6 @@ private function addCacheSection(ArrayNodeDefinition $rootNode, callable $willBe
13161263
privatefunctionaddPhpErrorsSection(ArrayNodeDefinition$rootNode):void
13171264
{
13181265
$rootNode
1319-
->validate()
1320-
->always(function (array$v):array {
1321-
if (!\array_key_exists('log',$v['php_errors'])) {
1322-
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.');
1323-
1324-
$v['php_errors']['log'] =$this->debug;
1325-
}
1326-
1327-
return$v;
1328-
})
1329-
->end()
13301266
->children()
13311267
->arrayNode('php_errors')
13321268
->info('PHP errors handling configuration')
@@ -1336,6 +1272,7 @@ private function addPhpErrorsSection(ArrayNodeDefinition $rootNode): void
13361272
->info('Use the application logger instead of the PHP logger for logging PHP errors.')
13371273
->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.')
13381274
->treatNullLike($this->debug)
1275+
->defaultTrue()
13391276
->beforeNormalization()
13401277
->ifArray()
13411278
->then(function (array$v):array {
@@ -2348,23 +2285,6 @@ private function addRateLimiterSection(ArrayNodeDefinition $rootNode, callable $
23482285
privatefunctionaddUidSection(ArrayNodeDefinition$rootNode,callable$enableIfStandalone):void
23492286
{
23502287
$rootNode
2351-
->validate()
2352-
->always(function ($v) {
2353-
if ($v['uid']['enabled']) {
2354-
if (!\array_key_exists('default_uuid_version',$v['uid'])) {
2355-
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.');
2356-
}
2357-
2358-
if (!\array_key_exists('time_based_uuid_version',$v['uid'])) {
2359-
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.');
2360-
}
2361-
}
2362-
2363-
$v['uid'] += ['default_uuid_version' =>6,'time_based_uuid_version' =>6];
2364-
2365-
return$v;
2366-
})
2367-
->end()
23682288
->children()
23692289
->arrayNode('uid')
23702290
->info('Uid configuration')
@@ -2373,6 +2293,7 @@ private function addUidSection(ArrayNodeDefinition $rootNode, callable $enableIf
23732293
->children()
23742294
->enumNode('default_uuid_version')
23752295
->values([7,6,4,1])
2296+
->defaultValue(7)
23762297
->end()
23772298
->enumNode('name_based_uuid_version')
23782299
->defaultValue(5)
@@ -2383,6 +2304,7 @@ private function addUidSection(ArrayNodeDefinition $rootNode, callable $enableIf
23832304
->end()
23842305
->enumNode('time_based_uuid_version')
23852306
->values([7,6,1])
2307+
->defaultValue(7)
23862308
->end()
23872309
->scalarNode('time_based_uuid_node')
23882310
->cannotBeEmpty()

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

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -181,7 +181,6 @@
181181
useSymfony\Component\Validator\Mapping\Loader\PropertyInfoLoader;
182182
useSymfony\Component\Validator\ObjectInitializerInterface;
183183
useSymfony\Component\Validator\Validation;
184-
useSymfony\Component\Validator\ValidatorBuilder;
185184
useSymfony\Component\Webhook\Controller\WebhookController;
186185
useSymfony\Component\WebLink\HttpHeaderSerializer;
187186
useSymfony\Component\Workflow;
@@ -1232,10 +1231,15 @@ private function registerSessionConfiguration(array $config, ContainerBuilder $c
12321231
$container->setParameter('session.storage.options',$options);
12331232

12341233
// session handler (the internal callback registered with PHP session management)
1235-
if (null ===$config['handler_id']) {
1234+
if (null ===($config['handler_id'] ??$config['save_path'] ??null)) {
12361235
$config['save_path'] =null;
12371236
$container->setAlias('session.handler','session.handler.native');
12381237
}else {
1238+
$config['handler_id'] ??='session.handler.native_file';
1239+
1240+
if (!\array_key_exists('save_path',$config)) {
1241+
$config['save_path'] ='%kernel.cache_dir%/sessions';
1242+
}
12391243
$container->resolveEnvPlaceholders($config['handler_id'],null,$usedEnvs);
12401244

12411245
if ($usedEnvs ||preg_match('#^[a-z]++://#',$config['handler_id'])) {

‎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)

[8]ページ先頭

©2009-2025 Movatter.jp