Thanks to visit codestin.com
Credit goes to github.com

Skip to content

[FrameworkBundle] Fix wiring session.handler when handler_id is null #49745

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 1 commit into from
Mar 28, 2023

Conversation

nicolas-grekas
Copy link
Member

@nicolas-grekas nicolas-grekas commented Mar 20, 2023

Q A
Branch? 5.4
Bug fix? yes
New feature? no
Deprecations? no
Tickets -
License MIT
Doc PR -

When the session handler_id is null, we currently set the $handler argument of the storage/factory services to null, which means to them "create your own handler internally from the native one". This means that the session.handler service is "a lie": it's not the real handler used by the storage. It also means that the %session.save_path% parameter is lying too, because it is set to %kernel.cache_dir%/sessions (by default), while the storage will use ini_get('session.save_path') in practice.

This issue is 10 years old... #5290

ini_set('session.save_path', $savePath);
ini_set('session.save_handler', 'files');
if ($savePath !== \ini_get('session.save_path')) {
ini_set('session.save_path', $savePath);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why do you need to check if different before setting the config?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it's not exactly needed for the fix, but this might remove useless "ini_set(): Session ini settings cannot be changed when a session is active".

@nicolas-grekas nicolas-grekas merged commit 020f0f9 into symfony:5.4 Mar 28, 2023
@nicolas-grekas nicolas-grekas deleted the fwb-session-handler branch March 28, 2023 07:29
This was referenced Mar 31, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants