Skip to content

Commit 85c6a01

Browse files
MathieuMatTheCat
Mathieu
authored andcommitted
[FrameworkBundle] update session configuration nodes’ documentation
1 parent 0480fdc commit 85c6a01

File tree

1 file changed

+60
-41
lines changed

1 file changed

+60
-41
lines changed

reference/configuration/framework.rst

Lines changed: 60 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -1586,38 +1586,39 @@ You can also :ref:`store sessions in a database <session-database>`.
15861586
name
15871587
....
15881588

1589-
**type**: ``string`` **default**: ``null``
1589+
**type**: ``string``
1590+
1591+
This specifies the name of the session cookie.
15901592

1591-
This specifies the name of the session cookie. By default, it will use the
1592-
cookie name which is defined in the ``php.ini`` with the ``session.name``
1593-
directive.
1593+
If not set, ``php.ini``'s `session.name`_ directive will be relied on.
15941594

15951595
cookie_lifetime
15961596
...............
15971597

1598-
**type**: ``integer`` **default**: ``null``
1598+
**type**: ``integer``
15991599

1600-
This determines the lifetime of the session - in seconds. The default value
1601-
- ``null`` - means that the ``session.cookie_lifetime`` value from ``php.ini``
1602-
will be used. Setting this value to ``0`` means the cookie is valid for
1600+
This determines the lifetime of the session - in seconds.
1601+
Setting this value to ``0`` means the cookie is valid for
16031602
the length of the browser session.
16041603

1604+
If not set, ``php.ini``'s `session.cookie_lifetime`_ directive will be relied on.
1605+
16051606
cookie_path
16061607
...........
16071608

1608-
**type**: ``string`` **default**: ``/``
1609+
**type**: ``string``
1610+
1611+
This determines the path to set in the session cookie.
16091612

1610-
This determines the path to set in the session cookie. By default, it will
1611-
use ``/``.
1613+
If not set, ``php.ini``'s `session.cookie_path`_ directive will be relied on.
16121614

16131615
cache_limiter
16141616
.............
16151617

1616-
**type**: ``string`` or ``int`` **default**: ``''``
1618+
**type**: ``string`` **default**: ``'0'``
16171619

1618-
If set to ``0``, Symfony won't set any particular header related to the cache
1619-
and it will rely on the cache control method configured in the
1620-
`session.cache-limiter`_ PHP.ini option.
1620+
If set to ``'0'``, Symfony won't set any particular header related to the cache
1621+
and it will rely on ``php.ini``'s `session.cache_limiter`_ directive.
16211622

16221623
Unlike the other session options, ``cache_limiter`` is set as a regular
16231624
:ref:`container parameter <configuration-parameters>`:
@@ -1654,19 +1655,22 @@ Unlike the other session options, ``cache_limiter`` is set as a regular
16541655
'cache_limiter' => 0,
16551656
]);
16561657
1658+
Be aware that if you configure it, you'll have to set other session-related options
1659+
as parameters as well.
1660+
16571661
cookie_domain
16581662
.............
16591663

1660-
**type**: ``string`` **default**: ``''``
1664+
**type**: ``string``
1665+
1666+
This determines the domain to set in the session cookie.
16611667

1662-
This determines the domain to set in the session cookie. By default, it's
1663-
blank, meaning the host name of the server which generated the cookie according
1664-
to the cookie specification.
1668+
If not set, ``php.ini``'s `session.cookie_domain`_ directive will be relied on.
16651669

16661670
cookie_samesite
16671671
...............
16681672

1669-
**type**: ``string`` or ``null`` **default**: ``'lax'``
1673+
**type**: ``string`` or ``null`` **default**: ``null``
16701674

16711675
It controls the way cookies are sent when the HTTP request did not originate
16721676
from the same domain that is associated with the cookies. Setting this option is
@@ -1680,8 +1684,7 @@ those cookies when making that HTTP request.
16801684

16811685
The possible values for this option are:
16821686

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

16961699
.. note::
16971700

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

17011704
cookie_secure
17021705
.............
17031706

1704-
**type**: ``boolean`` or ``'auto'`` **default**: ``'auto'``
1707+
**type**: ``boolean`` or ``'auto'``
17051708

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

1713+
If not set, ``php.ini``'s `session.cookie_secure`_ directive will be relied on.
1714+
17101715
cookie_httponly
17111716
...............
17121717

@@ -1720,10 +1725,12 @@ identity theft through XSS attacks.
17201725
gc_divisor
17211726
..........
17221727

1723-
**type**: ``integer`` **default**: ``100``
1728+
**type**: ``integer``
17241729

17251730
See `gc_probability`_.
17261731

1732+
If not set, ``php.ini``'s `session.gc_divisor`_ directive will be relied on.
1733+
17271734
gc_probability
17281735
..............
17291736

@@ -1737,45 +1744,46 @@ chance that the GC process will start on each request.
17371744
gc_maxlifetime
17381745
..............
17391746

1740-
**type**: ``integer`` **default**: ``1440``
1747+
**type**: ``integer``
17411748

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

1753+
If not set, ``php.ini``'s `session.gc_maxlifetime`_ directive will be relied on.
1754+
17461755
sid_length
17471756
..........
17481757

1749-
**type**: ``integer`` **default**: ``32``
1758+
**type**: ``integer``
17501759

17511760
This determines the length of session ID string, which can be an integer between
1752-
``22`` and ``256`` (both inclusive), being ``32`` the recommended value. Longer
1761+
``22`` and ``256`` (both inclusive), ``32`` being the recommended value. Longer
17531762
session IDs are harder to guess.
17541763

1755-
This option is related to the `session.sid_length PHP option`_.
1764+
If not set, ``php.ini``'s `session.sid_length`_ directive will be relied on.
17561765

17571766
sid_bits_per_character
17581767
......................
17591768

1760-
**type**: ``integer`` **default**: ``4``
1769+
**type**: ``integer``
17611770

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

1767-
This option is related to the `session.sid_bits_per_character PHP option`_.
1776+
If not set, ``php.ini``'s `session.sid_bits_per_character`_ directive will be relied on.
17681777

17691778
save_path
17701779
.........
17711780

1772-
**type**: ``string`` **default**: ``%kernel.cache_dir%/sessions``
1781+
**type**: ``string`` or ``null`` **default**: ``%kernel.cache_dir%/sessions``
17731782

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

1777-
You can also set this value to the ``save_path`` of your ``php.ini`` by
1778-
setting the value to ``null``:
1786+
If ``null``, ``php.ini``'s `session.save_path`_ directive will be relied on:
17791787

17801788
.. configuration-block::
17811789

@@ -1870,11 +1878,12 @@ Whether to enable the session support in the framework.
18701878
use_cookies
18711879
...........
18721880

1873-
**type**: ``boolean`` **default**: ``null``
1881+
**type**: ``boolean``
18741882

18751883
This specifies if the session ID is stored on the client side using cookies or
1876-
not. By default, it will use the value defined in the ``php.ini`` with the
1877-
``session.use_cookies`` directive.
1884+
not.
1885+
1886+
If not set, ``php.ini``'s `session.use_cookies`_ directive will be relied on.
18781887

18791888
assets
18801889
~~~~~~
@@ -3636,14 +3645,24 @@ use the configuration of the first exception that matches ``instanceof``:
36363645
.. _`json_encode flags bitmask`: https://www.php.net/json_encode
36373646
.. _`error_reporting PHP option`: https://www.php.net/manual/en/errorfunc.configuration.php#ini.error-reporting
36383647
.. _`CSRF security attacks`: https://en.wikipedia.org/wiki/Cross-site_request_forgery
3639-
.. _`session.sid_length PHP option`: https://www.php.net/manual/session.configuration.php#ini.session.sid-length
3640-
.. _`session.sid_bits_per_character PHP option`: https://www.php.net/manual/session.configuration.php#ini.session.sid-bits-per-character
36413648
.. _`X-Robots-Tag HTTP header`: https://developers.google.com/search/reference/robots_meta_tag
36423649
.. _`RFC 3986`: https://www.ietf.org/rfc/rfc3986.txt
36433650
.. _`default_socket_timeout`: https://www.php.net/manual/en/filesystem.configuration.php#ini.default-socket-timeout
36443651
.. _`PEM formatted`: https://en.wikipedia.org/wiki/Privacy-Enhanced_Mail
36453652
.. _`haveibeenpwned.com`: https://haveibeenpwned.com/
3646-
.. _`session.cache-limiter`: https://www.php.net/manual/en/session.configuration.php#ini.session.cache-limiter
3653+
.. _`session.name`: https://www.php.net/manual/en/session.configuration.php#ini.session.name
3654+
.. _`session.cookie_lifetime`: https://www.php.net/manual/en/session.configuration.php#ini.session.cookie-lifetime
3655+
.. _`session.cookie_path`: https://www.php.net/manual/en/session.configuration.php#ini.session.cookie-path
3656+
.. _`session.cache_limiter`: https://www.php.net/manual/en/session.configuration.php#ini.session.cache-limiter
3657+
.. _`session.cookie_domain`: https://www.php.net/manual/en/session.configuration.php#ini.session.cookie-domain
3658+
.. _`session.cookie_samesite`: https://www.php.net/manual/en/session.configuration.php#ini.session.cookie-samesite
3659+
.. _`session.cookie_secure`: https://www.php.net/manual/en/session.configuration.php#ini.session.cookie-secure
3660+
.. _`session.gc_divisor`: https://www.php.net/manual/en/session.configuration.php#ini.session.gc-divisor
3661+
.. _`session.gc_maxlifetime`: https://www.php.net/manual/en/session.configuration.php#ini.session.gc-maxlifetime
3662+
.. _`session.sid_length`: https://www.php.net/manual/en/session.configuration.php#ini.session.sid-length
3663+
.. _`session.sid_bits_per_character`: https://www.php.net/manual/en/session.configuration.php#ini.session.sid-bits-per-character
3664+
.. _`session.save_path`: https://www.php.net/manual/en/session.configuration.php#ini.session.save-path
3665+
.. _`session.use_cookies`: https://www.php.net/manual/en/session.configuration.php#ini.session.use-cookies
36473666
.. _`Microsoft NTLM authentication protocol`: https://docs.microsoft.com/en-us/windows/win32/secauthn/microsoft-ntlm
36483667
.. _`utf-8 modifier`: https://www.php.net/reference.pcre.pattern.modifiers
36493668
.. _`Link HTTP header`: https://tools.ietf.org/html/rfc5988

0 commit comments

Comments
 (0)