Skip to content

Commit 3aad012

Browse files
author
Mathieu
committed
[FrameworkBundle] update session configuration nodes’ documentation
1 parent c01f434 commit 3aad012

File tree

1 file changed

+41
-36
lines changed

1 file changed

+41
-36
lines changed

reference/configuration/framework.rst

Lines changed: 41 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -1589,29 +1589,31 @@ You can also :ref:`store sessions in a database <session-database>`.
15891589
name
15901590
....
15911591

1592-
**type**: ``string`` **default**: ``null``
1592+
**type**: ``string``
1593+
1594+
This specifies the name of the session cookie.
15931595

1594-
This specifies the name of the session cookie. By default, it will use the
1595-
cookie name which is defined in the ``php.ini`` with the ``session.name``
1596-
directive.
1596+
If not set, ``php.ini``'s ``session.name`` directive will be used.
15971597

15981598
cookie_lifetime
15991599
...............
16001600

1601-
**type**: ``integer`` **default**: ``null``
1601+
**type**: ``integer``
16021602

1603-
This determines the lifetime of the session - in seconds. The default value
1604-
- ``null`` - means that the ``session.cookie_lifetime`` value from ``php.ini``
1605-
will be used. Setting this value to ``0`` means the cookie is valid for
1603+
This determines the lifetime of the session - in seconds.
1604+
Setting this value to ``0`` means the cookie is valid for
16061605
the length of the browser session.
16071606

1607+
If not set, ``php.ini``'s ``session.cookie_lifetime`` directive will be used.
1608+
16081609
cookie_path
16091610
...........
16101611

1611-
**type**: ``string`` **default**: ``/``
1612+
**type**: ``string``
1613+
1614+
This determines the path to set in the session cookie.
16121615

1613-
This determines the path to set in the session cookie. By default, it will
1614-
use ``/``.
1616+
If not set, ``php.ini``'s ``session.cookie_path`` directive will be used.
16151617

16161618
cache_limiter
16171619
.............
@@ -1660,16 +1662,16 @@ Unlike the other session options, ``cache_limiter`` is set as a regular
16601662
cookie_domain
16611663
.............
16621664

1663-
**type**: ``string`` **default**: ``''``
1665+
**type**: ``string``
1666+
1667+
This determines the domain to set in the session cookie.
16641668

1665-
This determines the domain to set in the session cookie. By default, it's
1666-
blank, meaning the host name of the server which generated the cookie according
1667-
to the cookie specification.
1669+
If not set, ``php.ini``'s ``session.cookie_domain`` directive will be used.
16681670

16691671
cookie_samesite
16701672
...............
16711673

1672-
**type**: ``string`` or ``null`` **default**: ``'lax'``
1674+
**type**: ``string`` or ``null`` **default**: ``null``
16731675

16741676
It controls the way cookies are sent when the HTTP request did not originate
16751677
from the same domain that is associated with the cookies. Setting this option is
@@ -1683,8 +1685,7 @@ those cookies when making that HTTP request.
16831685

16841686
The possible values for this option are:
16851687

1686-
* ``null``, use it to disable this protection. Same behavior as in older Symfony
1687-
versions.
1688+
* ``null``, use ``php.ini``'s ``session.cookie_samesite`` directive.
16881689
* ``'none'`` (or the ``Symfony\Component\HttpFoundation\Cookie::SAMESITE_NONE`` constant), use it to allow
16891690
sending of cookies when the HTTP request originated from a different domain
16901691
(previously this was the default behavior of null, but in newer browsers ``'lax'``
@@ -1698,18 +1699,20 @@ The possible values for this option are:
16981699

16991700
.. note::
17001701

1701-
This option is available starting from PHP 7.3, but Symfony has a polyfill
1702-
so you can use it with any older PHP version as well.
1702+
Same-site cookies are a PHP 7.3 feature, but Symfony has a polyfill
1703+
so you can set this option with any older PHP version as well.
17031704

17041705
cookie_secure
17051706
.............
17061707

1707-
**type**: ``boolean`` or ``'auto'`` **default**: ``'auto'``
1708+
**type**: ``boolean`` or ``'auto'``
17081709

17091710
This determines whether cookies should only be sent over secure connections. In
17101711
addition to ``true`` and ``false``, there's a special ``'auto'`` value that
17111712
means ``true`` for HTTPS requests and ``false`` for HTTP requests.
17121713

1714+
If not set, ``php.ini``'s ``session.cookie_secure`` directive will be used.
1715+
17131716
cookie_httponly
17141717
...............
17151718

@@ -1723,10 +1726,12 @@ identity theft through XSS attacks.
17231726
gc_divisor
17241727
..........
17251728

1726-
**type**: ``integer`` **default**: ``100``
1729+
**type**: ``integer``
17271730

17281731
See `gc_probability`_.
17291732

1733+
If not set, ``php.ini``'s ``session.gc_divisor`` directive will be used.
1734+
17301735
gc_probability
17311736
..............
17321737

@@ -1740,45 +1745,46 @@ chance that the GC process will start on each request.
17401745
gc_maxlifetime
17411746
..............
17421747

1743-
**type**: ``integer`` **default**: ``1440``
1748+
**type**: ``integer``
17441749

17451750
This determines the number of seconds after which data will be seen as "garbage"
17461751
and potentially cleaned up. Garbage collection may occur during session
17471752
start and depends on `gc_divisor`_ and `gc_probability`_.
17481753

1754+
If not set, ``php.ini``'s ``session.gc_maxlifetime`` directive will be used.
1755+
17491756
sid_length
17501757
..........
17511758

1752-
**type**: ``integer`` **default**: ``32``
1759+
**type**: ``integer``
17531760

17541761
This determines the length of session ID string, which can be an integer between
1755-
``22`` and ``256`` (both inclusive), being ``32`` the recommended value. Longer
1762+
``22`` and ``256`` (both inclusive), ``32`` being the recommended value. Longer
17561763
session IDs are harder to guess.
17571764

1758-
This option is related to the `session.sid_length PHP option`_.
1765+
If not set, ``php.ini``'s ``session.sid_length`` directive will be used.
17591766

17601767
sid_bits_per_character
17611768
......................
17621769

1763-
**type**: ``integer`` **default**: ``4``
1770+
**type**: ``integer``
17641771

17651772
This determines the number of bits in the encoded session ID character. The possible
17661773
values are ``4`` (0-9, a-f), ``5`` (0-9, a-v), and ``6`` (0-9, a-z, A-Z, "-", ",").
17671774
The more bits results in stronger session ID. ``5`` is recommended value for
17681775
most environments.
17691776

1770-
This option is related to the `session.sid_bits_per_character PHP option`_.
1777+
If not set, ``php.ini``'s ``session.sid_bits_per_character`` directive will be used.
17711778

17721779
save_path
17731780
.........
17741781

1775-
**type**: ``string`` **default**: ``%kernel.cache_dir%/sessions``
1782+
**type**: ``string`` or ``null`` **default**: ``%kernel.cache_dir%/sessions``
17761783

17771784
This determines the argument to be passed to the save handler. If you choose
17781785
the default file handler, this is the path where the session files are created.
17791786

1780-
You can also set this value to the ``save_path`` of your ``php.ini`` by
1781-
setting the value to ``null``:
1787+
If ``null``, ``php.ini``'s ``session.save_path`` directive will be used:
17821788

17831789
.. configuration-block::
17841790

@@ -1873,11 +1879,12 @@ Whether to enable the session support in the framework.
18731879
use_cookies
18741880
...........
18751881

1876-
**type**: ``boolean`` **default**: ``null``
1882+
**type**: ``boolean``
18771883

18781884
This specifies if the session ID is stored on the client side using cookies or
1879-
not. By default, it will use the value defined in the ``php.ini`` with the
1880-
``session.use_cookies`` directive.
1885+
not.
1886+
1887+
If not set, ``php.ini``'s ``session.use_cookies`` directive will be used.
18811888

18821889
assets
18831890
~~~~~~
@@ -3628,8 +3635,6 @@ use the configuration of the first exception that matches ``instanceof``:
36283635
.. _`json_encode flags bitmask`: https://www.php.net/json_encode
36293636
.. _`error_reporting PHP option`: https://www.php.net/manual/en/errorfunc.configuration.php#ini.error-reporting
36303637
.. _`CSRF security attacks`: https://en.wikipedia.org/wiki/Cross-site_request_forgery
3631-
.. _`session.sid_length PHP option`: https://www.php.net/manual/session.configuration.php#ini.session.sid-length
3632-
.. _`session.sid_bits_per_character PHP option`: https://www.php.net/manual/session.configuration.php#ini.session.sid-bits-per-character
36333638
.. _`X-Robots-Tag HTTP header`: https://developers.google.com/search/reference/robots_meta_tag
36343639
.. _`RFC 3986`: https://www.ietf.org/rfc/rfc3986.txt
36353640
.. _`default_socket_timeout`: https://www.php.net/manual/en/filesystem.configuration.php#ini.default-socket-timeout

0 commit comments

Comments
 (0)