Skip to content

Commit 0bf83c3

Browse files
MathieuMatTheCat
Mathieu
authored andcommitted
[FrameworkBundle] update session configuration nodes’ documentation
1 parent 6a123d8 commit 0bf83c3

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
@@ -1688,38 +1688,39 @@ and also to configure the session handler with a DSN:
16881688
name
16891689
....
16901690

1691-
**type**: ``string`` **default**: ``null``
1691+
**type**: ``string``
1692+
1693+
This specifies the name of the session cookie.
16921694

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

16971697
cookie_lifetime
16981698
...............
16991699

1700-
**type**: ``integer`` **default**: ``null``
1700+
**type**: ``integer``
17011701

1702-
This determines the lifetime of the session - in seconds. The default value
1703-
- ``null`` - means that the ``session.cookie_lifetime`` value from ``php.ini``
1704-
will be used. Setting this value to ``0`` means the cookie is valid for
1702+
This determines the lifetime of the session - in seconds.
1703+
Setting this value to ``0`` means the cookie is valid for
17051704
the length of the browser session.
17061705

1706+
If not set, ``php.ini``'s `session.cookie_lifetime`_ directive will be relied on.
1707+
17071708
cookie_path
17081709
...........
17091710

1710-
**type**: ``string`` **default**: ``/``
1711+
**type**: ``string``
1712+
1713+
This determines the path to set in the session cookie.
17111714

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

17151717
cache_limiter
17161718
.............
17171719

1718-
**type**: ``string`` or ``int`` **default**: ``''``
1720+
**type**: ``string`` **default**: ``0``
17191721

17201722
If set to ``0``, Symfony won't set any particular header related to the cache
1721-
and it will rely on the cache control method configured in the
1722-
`session.cache-limiter`_ PHP.ini option.
1723+
and it will rely on ``php.ini``'s `session.cache_limiter`_ directive.
17231724

17241725
Unlike the other session options, ``cache_limiter`` is set as a regular
17251726
:ref:`container parameter <configuration-parameters>`:
@@ -1756,19 +1757,22 @@ Unlike the other session options, ``cache_limiter`` is set as a regular
17561757
'cache_limiter' => 0,
17571758
]);
17581759
1760+
Be aware that if you configure it, you'll have to set other session-related options
1761+
as parameters as well.
1762+
17591763
cookie_domain
17601764
.............
17611765

1762-
**type**: ``string`` **default**: ``''``
1766+
**type**: ``string``
1767+
1768+
This determines the domain to set in the session cookie.
17631769

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

17681772
cookie_samesite
17691773
...............
17701774

1771-
**type**: ``string`` or ``null`` **default**: ``lax``
1775+
**type**: ``string`` or ``null`` **default**: ``null``
17721776

17731777
It controls the way cookies are sent when the HTTP request did not originate
17741778
from the same domain that is associated with the cookies. Setting this option is
@@ -1782,8 +1786,7 @@ those cookies when making that HTTP request.
17821786

17831787
The possible values for this option are:
17841788

1785-
* ``null``, use it to disable this protection. Same behavior as in older Symfony
1786-
versions.
1789+
* ``null``, use ``php.ini``'s `session.cookie_samesite`_ directive.
17871790
* ``'none'`` (or the ``Symfony\Component\HttpFoundation\Cookie::SAMESITE_NONE`` constant), use it to allow
17881791
sending of cookies when the HTTP request originated from a different domain
17891792
(previously this was the default behavior of null, but in newer browsers ``'lax'``
@@ -1797,18 +1800,20 @@ The possible values for this option are:
17971800

17981801
.. note::
17991802

1800-
This option is available starting from PHP 7.3, but Symfony has a polyfill
1801-
so you can use it with any older PHP version as well.
1803+
Same-site cookies are a PHP 7.3 feature, but Symfony has a polyfill
1804+
so you can set this option with any older PHP version as well.
18021805

18031806
cookie_secure
18041807
.............
18051808

1806-
**type**: ``boolean`` or ``'auto'`` **default**: ``auto``
1809+
**type**: ``boolean`` or ``'auto'``
18071810

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

1815+
If not set, ``php.ini``'s `session.cookie_secure`_ directive will be relied on.
1816+
18121817
cookie_httponly
18131818
...............
18141819

@@ -1822,10 +1827,12 @@ identity theft through XSS attacks.
18221827
gc_divisor
18231828
..........
18241829

1825-
**type**: ``integer`` **default**: ``100``
1830+
**type**: ``integer``
18261831

18271832
See `gc_probability`_.
18281833

1834+
If not set, ``php.ini``'s `session.gc_divisor`_ directive will be relied on.
1835+
18291836
gc_probability
18301837
..............
18311838

@@ -1839,45 +1846,46 @@ chance that the GC process will start on each request.
18391846
gc_maxlifetime
18401847
..............
18411848

1842-
**type**: ``integer`` **default**: ``1440``
1849+
**type**: ``integer``
18431850

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

1855+
If not set, ``php.ini``'s `session.gc_maxlifetime`_ directive will be relied on.
1856+
18481857
sid_length
18491858
..........
18501859

1851-
**type**: ``integer`` **default**: ``32``
1860+
**type**: ``integer``
18521861

18531862
This determines the length of session ID string, which can be an integer between
1854-
``22`` and ``256`` (both inclusive), being ``32`` the recommended value. Longer
1863+
``22`` and ``256`` (both inclusive), ``32`` being the recommended value. Longer
18551864
session IDs are harder to guess.
18561865

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

18591868
sid_bits_per_character
18601869
......................
18611870

1862-
**type**: ``integer`` **default**: ``4``
1871+
**type**: ``integer``
18631872

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

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

18711880
save_path
18721881
.........
18731882

1874-
**type**: ``string`` **default**: ``%kernel.cache_dir%/sessions``
1883+
**type**: ``string`` or ``null`` **default**: ``%kernel.cache_dir%/sessions``
18751884

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

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

18821890
.. configuration-block::
18831891

@@ -1972,11 +1980,12 @@ Whether to enable the session support in the framework.
19721980
use_cookies
19731981
...........
19741982

1975-
**type**: ``boolean`` **default**: ``null``
1983+
**type**: ``boolean``
19761984

19771985
This specifies if the session ID is stored on the client side using cookies or
1978-
not. By default, it will use the value defined in the ``php.ini`` with the
1979-
``session.use_cookies`` directive.
1986+
not.
1987+
1988+
If not set, ``php.ini``'s `session.use_cookies`_ directive will be relied on.
19801989

19811990
ssi
19821991
~~~
@@ -3769,14 +3778,24 @@ use the configuration of the first exception that matches ``instanceof``:
37693778
.. _`json_encode flags bitmask`: https://www.php.net/json_encode
37703779
.. _`error_reporting PHP option`: https://www.php.net/manual/en/errorfunc.configuration.php#ini.error-reporting
37713780
.. _`CSRF security attacks`: https://en.wikipedia.org/wiki/Cross-site_request_forgery
3772-
.. _`session.sid_length PHP option`: https://www.php.net/manual/session.configuration.php#ini.session.sid-length
3773-
.. _`session.sid_bits_per_character PHP option`: https://www.php.net/manual/session.configuration.php#ini.session.sid-bits-per-character
37743781
.. _`X-Robots-Tag HTTP header`: https://developers.google.com/search/reference/robots_meta_tag
37753782
.. _`RFC 3986`: https://www.ietf.org/rfc/rfc3986.txt
37763783
.. _`default_socket_timeout`: https://www.php.net/manual/en/filesystem.configuration.php#ini.default-socket-timeout
37773784
.. _`PEM formatted`: https://en.wikipedia.org/wiki/Privacy-Enhanced_Mail
37783785
.. _`haveibeenpwned.com`: https://haveibeenpwned.com/
3779-
.. _`session.cache-limiter`: https://www.php.net/manual/en/session.configuration.php#ini.session.cache-limiter
3786+
.. _`session.name`: https://www.php.net/manual/en/session.configuration.php#ini.session.name
3787+
.. _`session.cookie_lifetime`: https://www.php.net/manual/en/session.configuration.php#ini.session.cookie-lifetime
3788+
.. _`session.cookie_path`: https://www.php.net/manual/en/session.configuration.php#ini.session.cookie-path
3789+
.. _`session.cache_limiter`: https://www.php.net/manual/en/session.configuration.php#ini.session.cache-limiter
3790+
.. _`session.cookie_domain`: https://www.php.net/manual/en/session.configuration.php#ini.session.cookie-domain
3791+
.. _`session.cookie_samesite`: https://www.php.net/manual/en/session.configuration.php#ini.session.cookie-samesite
3792+
.. _`session.cookie_secure`: https://www.php.net/manual/en/session.configuration.php#ini.session.cookie-secure
3793+
.. _`session.gc_divisor`: https://www.php.net/manual/en/session.configuration.php#ini.session.gc-divisor
3794+
.. _`session.gc_maxlifetime`: https://www.php.net/manual/en/session.configuration.php#ini.session.gc-maxlifetime
3795+
.. _`session.sid_length`: https://www.php.net/manual/en/session.configuration.php#ini.session.sid-length
3796+
.. _`session.sid_bits_per_character`: https://www.php.net/manual/en/session.configuration.php#ini.session.sid-bits-per-character
3797+
.. _`session.save_path`: https://www.php.net/manual/en/session.configuration.php#ini.session.save-path
3798+
.. _`session.use_cookies`: https://www.php.net/manual/en/session.configuration.php#ini.session.use-cookies
37803799
.. _`Microsoft NTLM authentication protocol`: https://docs.microsoft.com/en-us/windows/win32/secauthn/microsoft-ntlm
37813800
.. _`utf-8 modifier`: https://www.php.net/reference.pcre.pattern.modifiers
37823801
.. _`Link HTTP header`: https://tools.ietf.org/html/rfc5988

0 commit comments

Comments
 (0)