-
-
Notifications
You must be signed in to change notification settings - Fork 9.6k
[FrameworkBundle] Inform the user when save_path will be ignored #31620
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
Conversation
I haven't added tests yet because I'm not 100% sure what the best way to solve this was. This at least informs the user. However if it were possible to detect this and somehow have ini_set('session.save_path', $save_path); called that would fix the 'bug' but where to put that is a bit of a mystery. I also expect it may be useful to update the documentation related to this setting to explain why which I'd be happy to do if this was deemed the correct solution. |
src/Symfony/Bundle/FrameworkBundle/DependencyInjection/FrameworkExtension.php
Show resolved
Hide resolved
01f5e22
to
267a4f7
Compare
@@ -474,6 +475,12 @@ public function testNullSessionHandler() | |||
$this->assertNull($container->getDefinition('session.storage.php_bridge')->getArgument(0)); | |||
} | |||
|
|||
public function testNullSessionHandlerWithSavePath() | |||
{ | |||
$this->expectException(InvalidConfigurationException::class); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Must be converted to an annotation for tests to pass on old PHP versions.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
267a4f7
to
a090129
Compare
Thank you @gnat42. |
…gnored (gnat42) This PR was squashed before being merged into the 3.4 branch (closes #31620). Discussion ---------- [FrameworkBundle] Inform the user when save_path will be ignored | Q | A | ------------- | --- | Branch? | 3.4 | Bug fix? | yes | New feature? | no | BC breaks? | no / maybe?? | Deprecations? | no | Tests pass? | yes | Fixed tickets | #31611 | License | MIT When a project is created, framework.yaml or config.yml has handler_id set to ~. This uses the native php SessionHandler object which is instantiated with the save_path setting from php.ini or php-fpm.d/www.conf. If you set a save_path, it is silently ignored. When using mod_php for apache or php-fpm running as apache/nginx this is typically not a big deal (except your session files are stored someplace other than you actually wanted). However if using php-fpm and running as a non-standard user for the distro, it will fail silently. Sessions won't be saved because the setting has no effect. This throws a warning in those cases to inform the user. _It could be a BC because it changes the default configuration however fixes a 'long standing bug' if you will. Not sure what you want to do about that part._ Commits ------- a090129 [FrameworkBundle] Inform the user when save_path will be ignored
thank you! @fabpot |
… notice instead
* 3.4: Revert "bug #31620 [FrameworkBundle] Inform the user when save_path will be ignored (gnat42)" [Form][PropertyPathMapper] Avoid extra call to get config
* 4.3: Revert "bug #31620 [FrameworkBundle] Inform the user when save_path will be ignored (gnat42)" [Form][PropertyPathMapper] Avoid extra call to get config [HttpKernel] remove unused fixtures
* 4.4: Revert "bug #31620 [FrameworkBundle] Inform the user when save_path will be ignored (gnat42)" [Form][PropertyPathMapper] Avoid extra call to get config [HttpKernel] remove unused fixtures
When a project is created, framework.yaml or config.yml has handler_id set to ~. This uses the native php SessionHandler object which is instantiated with the save_path setting from php.ini or php-fpm.d/www.conf. If you set a save_path, it is silently ignored. When using mod_php for apache or php-fpm running as apache/nginx this is typically not a big deal (except your session files are stored someplace other than you actually wanted). However if using php-fpm and running as a non-standard user for the distro, it will fail silently. Sessions won't be saved because the setting has no effect. This throws a warning in those cases to inform the user.
It could be a BC because it changes the default configuration however fixes a 'long standing bug' if you will. Not sure what you want to do about that part.