8000 [FrameworkBundle] Deprecate not setting both `framework.session.save_… · symfony/symfony@85faa69 · GitHub
[go: up one dir, main page]

Skip to content

Commit 85faa69

Browse files
[FrameworkBundle] Deprecate not setting both framework.session.save_path and framework.session.handler_id at the same time
1 parent 9a0f178 commit 85faa69

File tree

3 files changed

+13
-3
line 8000 s changed

3 files changed

+13
-3
lines changed

UPGRADE-6.4.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,7 @@ FrameworkBundle
9090
* Deprecate not setting the `framework.session.coo 8000 kie_secure` config option; it will default to `auto` in 7.0
9191
* Deprecate not setting the `framework.session.cookie_samesite` config option; it will default to `lax` in 7.0
9292
* Deprecate not setting the `framework.session.handler_id` config option; it will default to `session.handler.native_file` when `framework.session.save_path` is set or `null` otherwise in 7.0
93+
* Deprecate not setting the `framework.session.save_path` config option when `framework.session.handler_id` is not set; it will default to `null` in 7.0
9394
* Deprecate not setting the `framework.uid.default_uuid_version` config option; it will default to `7` in 7.0
9495
* Deprecate not setting the `framework.uid.time_based_uuid_version` config option; it will default to `7` in 7.0
9596
* Deprecate not setting the `framework.validation.email_validation_mode` config option; it will default to `html5` in 7.0

src/Symfony/Bundle/FrameworkBundle/CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ CHANGELOG
1818
* Deprecate not setting the `framework.session.cookie_secure` config option; it will default to `auto` in 7.0
1919
* Deprecate not setting the `framework.session.cookie_samesite` config option; it will default to `lax` in 7.0
2020
* Deprecate not setting the `framework.session.handler_id` config option; it will default to `session.handler.native_file` when `framework.session.save_path` is set or `null` otherwise in 7.0
21+
* Deprecate not setting the `framework.session.save_path` config option when `framework.session.handler_id` is not set; it will default to `null` in 7.0
2122
* Deprecate not setting the `framework.uid.default_uuid_version` config option; it will default to `7` in 7.0
2223
* Deprecate not setting the `framework.uid.time_based_uuid_version` config option; it will default to `7` in 7.0
2324
* Deprecate not setting the `framework.validation.email_validation_mode` config option; it will default to `html5` in 7.0

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

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -670,11 +670,19 @@ private function addSessionSection(ArrayNodeDefinition $rootNode): void
670670
}
671671

672672
if (!\array_key_exists('handler_id', $v['session'])) {
673-
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.');
673+
if (!\array_key_exists('save_path', $v['session'])) {
674+
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.');
675+
} else {
676+
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.');
677+
}
674678
}
675679
}
676680

677-
$v['session'] += ['cookie_samesite' => null, 'handler_id' => 'session.handler.native_file'];
681+
$v['session'] += [
682+
'cookie_samesite' => null,
683+
'handler_id' => 'session.handler.native_file',
684+
'save_path' => '%kernel.cache_dir%/sessions',
685+
];
678686

679687
return $v;
680688
})
@@ -706,7 +714,7 @@ private function addSessionSection(ArrayNodeDefinition $rootNode): void
706714
->scalarNode('gc_divisor')->end()
707715
->scalarNode('gc_probability')->defaultValue(1)->end()
708716
->scalarNode('gc_maxlifetime')->end()
709-
->scalarNode('save_path')->defaultValue('%kernel.cache_dir%/sessions')->end()
717+
->scalarNode('save_path')->end()
710718
->integerNode('metadata_update_threshold')
711719
->defaultValue(0)
712720
->info('seconds to wait between 2 session metadata updates')

0 commit comments

Comments
 (0)
0