Skip to content

Commit f7558ef

Browse files
committed
Merge branch '7.2' into 7.3
* 7.2: remove a gc_probability default mention
2 parents 6b0e324 + 977be32 commit f7558ef

File tree

1 file changed

+13
-9
lines changed

1 file changed

+13
-9
lines changed

session.rst

Lines changed: 13 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -492,27 +492,31 @@ the ``php.ini`` directive ``session.gc_maxlifetime``. The meaning in this contex
492492
that any stored session that was saved more than ``gc_maxlifetime`` ago should be
493493
deleted. This allows one to expire records based on idle time.
494494

495-
However, some operating systems (e.g. Debian) do their own session handling and set
496-
the ``session.gc_probability`` variable to ``0`` to stop PHP doing garbage
497-
collection. That's why Symfony now overwrites this value to ``1``.
498-
499-
If you wish to use the original value set in your ``php.ini``, add the following
500-
configuration:
495+
However, some operating systems (e.g. Debian) manage session handling differently
496+
and set the ``session.gc_probability`` variable to ``0`` to prevent PHP from performing
497+
garbage collection. By default, Symfony uses the value of the ``gc_probability``
498+
directive set in the ``php.ini`` file. If you can't modify this PHP setting, you
499+
can configure it directly in Symfony:
501500

502501
.. code-block:: yaml
503502
504503
# config/packages/framework.yaml
505504
framework:
506505
session:
507506
# ...
508-
gc_probability: null
507+
gc_probability: 1
509508
510-
You can configure these settings by passing ``gc_probability``, ``gc_divisor``
511-
and ``gc_maxlifetime`` in an array to the constructor of
509+
Alternatively, you can configure these settings by passing ``gc_probability``,
510+
``gc_divisor`` and ``gc_maxlifetime`` in an array to the constructor of
512511
:class:`Symfony\\Component\\HttpFoundation\\Session\\Storage\\NativeSessionStorage`
513512
or to the :method:`Symfony\\Component\\HttpFoundation\\Session\\Storage\\NativeSessionStorage::setOptions`
514513
method.
515514

515+
.. versionadded:: 7.2
516+
517+
Using the ``php.ini`` directive as the default value for ``gc_probability``
518+
was introduced in Symfony 7.2.
519+
516520
.. _session-database:
517521

518522
Store Sessions in a Database

0 commit comments

Comments
 (0)