Skip to content

[FrameworkBundle] Deprecate not setting both framework.session.save_path and framework.session.handler_id at the same time #51438

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

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions UPGRADE-6.4.md
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,7 @@ FrameworkBundle
* Deprecate not setting the `framework.session.cookie_secure` config option; it will default to `auto` in 7.0
* Deprecate not setting the `framework.session.cookie_samesite` config option; it will default to `lax` in 7.0
* 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
* 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
* Deprecate not setting the `framework.uid.default_uuid_version` config option; it will default to `7` in 7.0
* Deprecate not setting the `framework.uid.time_based_uuid_version` config option; it will default to `7` in 7.0
* Deprecate not setting the `framework.validation.email_validation_mode` config option; it will default to `html5` in 7.0
Expand Down
1 change: 1 addition & 0 deletions src/Symfony/Bundle/FrameworkBundle/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ CHANGELOG
* Deprecate not setting the `framework.session.cookie_secure` config option; it will default to `auto` in 7.0
* Deprecate not setting the `framework.session.cookie_samesite` config option; it will default to `lax` in 7.0
* 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
* 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
* Deprecate not setting the `framework.uid.default_uuid_version` config option; it will default to `7` in 7.0
* Deprecate not setting the `framework.uid.time_based_uuid_version` config option; it will default to `7` in 7.0
* Deprecate not setting the `framework.validation.email_validation_mode` config option; it will default to `html5` in 7.0
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -670,11 +670,19 @@ private function addSessionSection(ArrayNodeDefinition $rootNode): void
}

if (!\array_key_exists('handler_id', $v['session'])) {
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.');
if (!\array_key_exists('save_path', $v['session'])) {
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.');
} else {
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.');
}
}
}

$v['session'] += ['cookie_samesite' => null, 'handler_id' => 'session.handler.native_file'];
$v['session'] += [
'cookie_samesite' => null,
'handler_id' => 'session.handler.native_file',
'save_path' => '%kernel.cache_dir%/sessions',
];

return $v;
})
Expand Down Expand Up @@ -706,7 +714,7 @@ private function addSessionSection(ArrayNodeDefinition $rootNode): void
->scalarNode('gc_divisor')->end()
->scalarNode('gc_probability')->defaultValue(1)->end()
->scalarNode('gc_maxlifetime')->end()
->scalarNode('save_path')->defaultValue('%kernel.cache_dir%/sessions')->end()
->scalarNode('save_path')->end()
->integerNode('metadata_update_threshold')
->defaultValue(0)
->info('seconds to wait between 2 session metadata updates')
Expand Down