8000 feature #58165 [FrameworkBundle] Remove default value for `gc_probabi… · symfony/symfony@14e99f0 · GitHub
[go: up one dir, main page]

Skip to content

Commit 14e99f0

Browse files
committed
feature #58165 [FrameworkBundle] Remove default value for gc_probability config option (nicolas-grekas)
This PR was merged into the 7.2 branch. Discussion ---------- [FrameworkBundle] Remove default value for `gc_probability` config option | Q | A | ------------- | --- | Branch? | 7.2 | Bug fix? | no | New feature? | no | Deprecations? | no | Issues | - | License | MIT While playing on a test app, I experienced an error related to the session GC: > Notice: SessionHandler::gc(): ps_files_cleanup_dir: opendir(/var/lib/php/sessions) failed: Permission denied (13) This is triggered by StrictSessionHandler calling the gc() method of the native session handler. I figured out the GC was running with 1/1440 probability so I tried increasing the probability to reproduce. I did so patching my ini settings and this did nothing, until I figured out that the corresponding option shadows the ini settings. This was done 10 years ago in #10366 (/cc `@fabpot`) to fix #10349. Re-reading that issue, I think it doesn't apply anymore: by default, we now encourage storing sessions in the folder configured in the ini settings also. Let's revert that PR. Then, what about the error itself? It happens because the folder configured on my Ubuntu doesn't have the `x` permission, so that the session GC cannot list its content. This is consistent with `session.gc_probability` being set to `0`. My host relies on cron instead of this GC. Which means there's nothing else to fix actually. Commits ------- e42eb19 [FrameworkBundle] Remove default value for gc_probability config option
2 parents bb53ec1 + e42eb19 commit 14e99f0

File tree

2 files changed

+1
-2
lines changed

2 files changed

+1
-2
lines changed

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -673,7 +673,7 @@ private function addSessionSection(ArrayNodeDefinition $rootNode): void
673673
->enumNode('cookie_samesite')->values([null, Cookie::SAMESITE_LAX, Cookie::SAMESITE_STRICT, Cookie::SAMESITE_NONE])->defaultValue('lax')->end()
674674
->booleanNode('use_cookies')->end()
675675
->scalarNode('gc_divisor')->end()
676-
->scalarNode('gc_probability')->defaultValue(1)->end()
676+
->scalarNode('gc_probability')->end()
677677
->scalarNode('gc_maxlifetime')->end()
678678
->scalarNode('save_path')
679679
->info('Defaults to "%kernel.cache_dir%/sessions" if the "handler_id" option is not null')

src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/ConfigurationTest.php

Lines changed: 0 additions & 1 deletion
< 66DE /div>
Original file line numberDiff line numberDiff line change
@@ -814,7 +814,6 @@ protected static function getBundleDefaultConfig()
814814
'cookie_httponly' => true,
815815
'cookie_samesite' => 'lax',
816816
'cookie_secure' => 'auto',
817-
'gc_probability' => 1,
818817
'metadata_update_threshold' => 0,
819818
],
820819
'request' => [

0 commit comments

Comments
 (0)
0