Skip to content

Commit d6f4f2b

Browse files
MathieuMatTheCat
Mathieu
authored andcommitted
[FrameworkBundle] update session configuration nodes’ documentation
1 parent 123bc51 commit d6f4f2b

File tree

1 file changed

+59
-40
lines changed

1 file changed

+59
-40
lines changed

reference/configuration/framework.rst

Lines changed: 59 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -1618,38 +1618,39 @@ You can also :ref:`store sessions in a database <session-database>`.
16181618
name
16191619
....
16201620

1621-
**type**: ``string`` **default**: ``null``
1621+
**type**: ``string``
1622+
1623+
This specifies the name of the session cookie.
16221624

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

16271627
cookie_lifetime
16281628
...............
16291629

1630-
**type**: ``integer`` **default**: ``null``
1630+
**type**: ``integer``
16311631

1632-
This determines the lifetime of the session - in seconds. The default value
1633-
- ``null`` - means that the ``session.cookie_lifetime`` value from ``php.ini``
1634-
will be used. Setting this value to ``0`` means the cookie is valid for
1632+
This determines the lifetime of the session - in seconds.
1633+
Setting this value to ``0`` means the cookie is valid for
16351634
the length of the browser session.
16361635

1636+
If not set, ``php.ini``'s `session.cookie_lifetime`_ directive will be relied on.
1637+
16371638
cookie_path
16381639
...........
16391640

1640-
**type**: ``string`` **default**: ``/``
1641+
**type**: ``string``
1642+
1643+
This determines the path to set in the session cookie.
16411644

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

16451647
cache_limiter
16461648
.............
16471649

1648-
**type**: ``string`` or ``int`` **default**: ``''``
1650+
**type**: ``string`` **default**: ``0``
16491651

16501652
If set to ``0``, Symfony won't set any particular header related to the cache
1651-
and it will rely on the cache control method configured in the
1652-
`session.cache-limiter`_ PHP.ini option.
1653+
and it will rely on ``php.ini``'s `session.cache_limiter`_ directive.
16531654

16541655
Unlike the other session options, ``cache_limiter`` is set as a regular
16551656
:ref:`container parameter <configuration-parameters>`:
@@ -1686,19 +1687,22 @@ Unlike the other session options, ``cache_limiter`` is set as a regular
16861687
'cache_limiter' => 0,
16871688
]);
16881689
1690+
Be aware that if you configure it, you'll have to set other session-related options
1691+
as parameters as well.
1692+
16891693
cookie_domain
16901694
.............
16911695

1692-
**type**: ``string`` **default**: ``''``
1696+
**type**: ``string``
1697+
1698+
This determines the domain to set in the session cookie.
16931699

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

16981702
cookie_samesite
16991703
...............
17001704

1701-
**type**: ``string`` or ``null`` **default**: ``lax``
1705+
**type**: ``string`` or ``null`` **default**: ``null``
17021706

17031707
It controls the way cookies are sent when the HTTP request did not originate
17041708
from the same domain that is associated with the cookies. Setting this option is
@@ -1712,8 +1716,7 @@ those cookies when making that HTTP request.
17121716

17131717
The possible values for this option are:
17141718

1715-
* ``null``, use it to disable this protection. Same behavior as in older Symfony
1716-
versions.
1719+
* ``null``, use ``php.ini``'s `session.cookie_samesite`_ directive.
17171720
* ``'none'`` (or the ``Symfony\Component\HttpFoundation\Cookie::SAMESITE_NONE`` constant), use it to allow
17181721
sending of cookies when the HTTP request originated from a different domain
17191722
(previously this was the default behavior of null, but in newer browsers ``'lax'``
@@ -1727,18 +1730,20 @@ The possible values for this option are:
17271730

17281731
.. note::
17291732

1730-
This option is available starting from PHP 7.3, but Symfony has a polyfill
1731-
so you can use it with any older PHP version as well.
1733+
Same-site cookies are a PHP 7.3 feature, but Symfony has a polyfill
1734+
so you can set this option with any older PHP version as well.
17321735

17331736
cookie_secure
17341737
.............
17351738

1736-
**type**: ``boolean`` or ``'auto'`` **default**: ``auto``
1739+
**type**: ``boolean`` or ``'auto'``
17371740

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

1745+
If not set, ``php.ini``'s `session.cookie_secure`_ directive will be relied on.
1746+
17421747
cookie_httponly
17431748
...............
17441749

@@ -1752,10 +1757,12 @@ identity theft through XSS attacks.
17521757
gc_divisor
17531758
..........
17541759

1755-
**type**: ``integer`` **default**: ``100``
1760+
**type**: ``integer``
17561761

17571762
See `gc_probability`_.
17581763

1764+
If not set, ``php.ini``'s `session.gc_divisor`_ directive will be relied on.
1765+
17591766
gc_probability
17601767
..............
17611768

@@ -1769,45 +1776,46 @@ chance that the GC process will start on each request.
17691776
gc_maxlifetime
17701777
..............
17711778

1772-
**type**: ``integer`` **default**: ``1440``
1779+
**type**: ``integer``
17731780

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

1785+
If not set, ``php.ini``'s `session.gc_maxlifetime`_ directive will be relied on.
1786+
17781787
sid_length
17791788
..........
17801789

1781-
**type**: ``integer`` **default**: ``32``
1790+
**type**: ``integer``
17821791

17831792
This determines the length of session ID string, which can be an integer between
1784-
``22`` and ``256`` (both inclusive), being ``32`` the recommended value. Longer
1793+
``22`` and ``256`` (both inclusive), ``32`` being the recommended value. Longer
17851794
session IDs are harder to guess.
17861795

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

17891798
sid_bits_per_character
17901799
......................
17911800

1792-
**type**: ``integer`` **default**: ``4``
1801+
**type**: ``integer``
17931802

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

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

18011810
save_path
18021811
.........
18031812

1804-
**type**: ``string`` **default**: ``%kernel.cache_dir%/sessions``
1813+
**type**: ``string`` or ``null`` **default**: ``%kernel.cache_dir%/sessions``
18051814

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

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

18121820
.. configuration-block::
18131821

@@ -1902,11 +1910,12 @@ Whether to enable the session support in the framework.
19021910
use_cookies
19031911
...........
19041912

1905-
**type**: ``boolean`` **default**: ``null``
1913+
**type**: ``boolean``
19061914

19071915
This specifies if the session ID is stored on the client side using cookies or
1908-
not. By default, it will use the value defined in the ``php.ini`` with the
1909-
``session.use_cookies`` directive.
1916+
not.
1917+
1918+
If not set, ``php.ini``'s `session.use_cookies`_ directive will be relied on.
19101919

19111920
ssi
19121921
~~~
@@ -3699,14 +3708,24 @@ use the configuration of the first exception that matches ``instanceof``:
36993708
.. _`json_encode flags bitmask`: https://www.php.net/json_encode
37003709
.. _`error_reporting PHP option`: https://www.php.net/manual/en/errorfunc.configuration.php#ini.error-reporting
37013710
.. _`CSRF security attacks`: https://en.wikipedia.org/wiki/Cross-site_request_forgery
3702-
.. _`session.sid_length PHP option`: https://www.php.net/manual/session.configuration.php#ini.session.sid-length
3703-
.. _`session.sid_bits_per_character PHP option`: https://www.php.net/manual/session.configuration.php#ini.session.sid-bits-per-character
37043711
.. _`X-Robots-Tag HTTP header`: https://developers.google.com/search/reference/robots_meta_tag
37053712
.. _`RFC 3986`: https://www.ietf.org/rfc/rfc3986.txt
37063713
.. _`default_socket_timeout`: https://www.php.net/manual/en/filesystem.configuration.php#ini.default-socket-timeout
37073714
.. _`PEM formatted`: https://en.wikipedia.org/wiki/Privacy-Enhanced_Mail
37083715
.. _`haveibeenpwned.com`: https://haveibeenpwned.com/
3709-
.. _`session.cache-limiter`: https://www.php.net/manual/en/session.configuration.php#ini.session.cache-limiter
3716+
.. _`session.name`: https://www.php.net/manual/en/session.configuration.php#ini.session.name
3717+
.. _`session.cookie_lifetime`: https://www.php.net/manual/en/session.configuration.php#ini.session.cookie-lifetime
3718+
.. _`session.cookie_path`: https://www.php.net/manual/en/session.configuration.php#ini.session.cookie-path
3719+
.. _`session.cache_limiter`: https://www.php.net/manual/en/session.configuration.php#ini.session.cache-limiter
3720+
.. _`session.cookie_domain`: https://www.php.net/manual/en/session.configuration.php#ini.session.cookie-domain
3721+
.. _`session.cookie_samesite`: https://www.php.net/manual/en/session.configuration.php#ini.session.cookie-samesite
3722+
.. _`session.cookie_secure`: https://www.php.net/manual/en/session.configuration.php#ini.session.cookie-secure
3723+
.. _`session.gc_divisor`: https://www.php.net/manual/en/session.configuration.php#ini.session.gc-divisor
3724+
.. _`session.gc_maxlifetime`: https://www.php.net/manual/en/session.configuration.php#ini.session.gc-maxlifetime
3725+
.. _`session.sid_length`: https://www.php.net/manual/en/session.configuration.php#ini.session.sid-length
3726+
.. _`session.sid_bits_per_character`: https://www.php.net/manual/en/session.configuration.php#ini.session.sid-bits-per-character
3727+
.. _`session.save_path`: https://www.php.net/manual/en/session.configuration.php#ini.session.save-path
3728+
.. _`session.use_cookies`: https://www.php.net/manual/en/session.configuration.php#ini.session.use-cookies
37103729
.. _`Microsoft NTLM authentication protocol`: https://docs.microsoft.com/en-us/windows/win32/secauthn/microsoft-ntlm
37113730
.. _`utf-8 modifier`: https://www.php.net/reference.pcre.pattern.modifiers
37123731
.. _`Link HTTP header`: https://tools.ietf.org/html/rfc5988

0 commit comments

Comments
 (0)