Skip to content

Commit ac73d17

Browse files
committed
Merge branch '5.4' into 6.3
* 5.4: [FrameworkBundle] update `session` configuration nodes’ documentation
2 parents 387cca1 + 597a955 commit ac73d17

File tree

1 file changed

+57
-38
lines changed

1 file changed

+57
-38
lines changed

reference/configuration/framework.rst

Lines changed: 57 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -1723,38 +1723,39 @@ and also to configure the session handler with a DSN:
17231723
name
17241724
....
17251725

1726-
**type**: ``string`` **default**: ``null``
1726+
**type**: ``string``
1727+
1728+
This specifies the name of the session cookie.
17271729

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

17321732
cookie_lifetime
17331733
...............
17341734

1735-
**type**: ``integer`` **default**: ``null``
1735+
**type**: ``integer``
17361736

1737-
This determines the lifetime of the session - in seconds. The default value
1738-
- ``null`` - means that the ``session.cookie_lifetime`` value from ``php.ini``
1739-
will be used. Setting this value to ``0`` means the cookie is valid for
1737+
This determines the lifetime of the session - in seconds.
1738+
Setting this value to ``0`` means the cookie is valid for
17401739
the length of the browser session.
17411740

1741+
If not set, ``php.ini``'s `session.cookie_lifetime`_ directive will be relied on.
1742+
17421743
cookie_path
17431744
...........
17441745

1745-
**type**: ``string`` **default**: ``/``
1746+
**type**: ``string``
1747+
1748+
This determines the path to set in the session cookie.
17461749

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

17501752
cache_limiter
17511753
.............
17521754

1753-
**type**: ``string`` or ``int`` **default**: (an empty string)
1755+
**type**: ``string`` **default**: ``0``
17541756

17551757
If set to ``0``, Symfony won't set any particular header related to the cache
1756-
and it will rely on the cache control method configured in the
1757-
`session.cache-limiter`_ PHP.ini option.
1758+
and it will rely on ``php.ini``'s `session.cache_limiter`_ directive.
17581759

17591760
Unlike the other session options, ``cache_limiter`` is set as a regular
17601761
:ref:`container parameter <configuration-parameters>`:
@@ -1791,19 +1792,22 @@ Unlike the other session options, ``cache_limiter`` is set as a regular
17911792
'cache_limiter' => 0,
17921793
]);
17931794
1795+
Be aware that if you configure it, you'll have to set other session-related options
1796+
as parameters as well.
1797+
17941798
cookie_domain
17951799
.............
17961800

1797-
**type**: ``string`` **default**: (an empty string)``''``
1801+
**type**: ``string``
1802+
1803+
This determines the domain to set in the session cookie.
17981804

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

18031807
cookie_samesite
18041808
...............
18051809

1806-
**type**: ``string`` or ``null`` **default**: ``lax``
1810+
**type**: ``string`` or ``null`` **default**: ``null``
18071811

18081812
It controls the way cookies are sent when the HTTP request did not originate
18091813
from the same domain that is associated with the cookies. Setting this option is
@@ -1817,8 +1821,7 @@ those cookies when making that HTTP request.
18171821

18181822
The possible values for this option are:
18191823

1820-
* ``null``, use it to disable this protection. Same behavior as in older Symfony
1821-
versions.
1824+
* ``null``, use ``php.ini``'s `session.cookie_samesite`_ directive.
18221825
* ``'none'`` (or the ``Symfony\Component\HttpFoundation\Cookie::SAMESITE_NONE`` constant), use it to allow
18231826
sending of cookies when the HTTP request originated from a different domain
18241827
(previously this was the default behavior of null, but in newer browsers ``'lax'``
@@ -1833,12 +1836,14 @@ The possible values for this option are:
18331836
cookie_secure
18341837
.............
18351838

1836-
**type**: ``boolean`` or ``'auto'`` **default**: ``auto``
1839+
**type**: ``boolean`` or ``'auto'``
18371840

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

1845+
If not set, ``php.ini``'s `session.cookie_secure`_ directive will be relied on.
1846+
18421847
cookie_httponly
18431848
...............
18441849

@@ -1852,10 +1857,12 @@ identity theft through XSS attacks.
18521857
gc_divisor
18531858
..........
18541859

1855-
**type**: ``integer`` **default**: ``100``
1860+
**type**: ``integer``
18561861

18571862
See `gc_probability`_.
18581863

1864+
If not set, ``php.ini``'s `session.gc_divisor`_ directive will be relied on.
1865+
18591866
gc_probability
18601867
..............
18611868

@@ -1869,45 +1876,46 @@ chance that the GC process will start on each request.
18691876
gc_maxlifetime
18701877
..............
18711878

1872-
**type**: ``integer`` **default**: ``1440``
1879+
**type**: ``integer``
18731880

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

1885+
If not set, ``php.ini``'s `session.gc_maxlifetime`_ directive will be relied on.
1886+
18781887
sid_length
18791888
..........
18801889

1881-
**type**: ``integer`` **default**: ``32``
1890+
**type**: ``integer``
18821891

18831892
This determines the length of session ID string, which can be an integer between
1884-
``22`` and ``256`` (both inclusive), being ``32`` the recommended value. Longer
1893+
``22`` and ``256`` (both inclusive), ``32`` being the recommended value. Longer
18851894
session IDs are harder to guess.
18861895

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

18891898
sid_bits_per_character
18901899
......................
18911900

1892-
**type**: ``integer`` **default**: ``4``
1901+
**type**: ``integer``
18931902

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

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

19011910
save_path
19021911
.........
19031912

1904-
**type**: ``string`` **default**: ``%kernel.cache_dir%/sessions``
1913+
**type**: ``string`` or ``null`` **default**: ``%kernel.cache_dir%/sessions``
19051914

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

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

19121920
.. configuration-block::
19131921

@@ -2002,11 +2010,12 @@ Whether to enable the session support in the framework.
20022010
use_cookies
20032011
...........
20042012

2005-
**type**: ``boolean`` **default**: ``null``
2013+
**type**: ``boolean``
20062014

20072015
This specifies if the session ID is stored on the client side using cookies or
2008-
not. By default, it will use the value defined in the ``php.ini`` with the
2009-
``session.use_cookies`` directive.
2016+
not.
2017+
2018+
If not set, ``php.ini``'s `session.use_cookies`_ directive will be relied on.
20102019

20112020
ssi
20122021
~~~
@@ -3884,14 +3893,24 @@ the ``#[WithLogLevel]`` attribute::
38843893
.. _`json_encode flags bitmask`: https://www.php.net/json_encode
38853894
.. _`error_reporting PHP option`: https://www.php.net/manual/en/errorfunc.configuration.php#ini.error-reporting
38863895
.. _`CSRF security attacks`: https://en.wikipedia.org/wiki/Cross-site_request_forgery
3887-
.. _`session.sid_length PHP option`: https://www.php.net/manual/session.configuration.php#ini.session.sid-length
3888-
.. _`session.sid_bits_per_character PHP option`: https://www.php.net/manual/session.configuration.php#ini.session.sid-bits-per-character
38893896
.. _`X-Robots-Tag HTTP header`: https://developers.google.com/search/reference/robots_meta_tag
38903897
.. _`RFC 3986`: https://www.ietf.org/rfc/rfc3986.txt
38913898
.. _`default_socket_timeout`: https://www.php.net/manual/en/filesystem.configuration.php#ini.default-socket-timeout
38923899
.. _`PEM formatted`: https://en.wikipedia.org/wiki/Privacy-Enhanced_Mail
38933900
.. _`haveibeenpwned.com`: https://haveibeenpwned.com/
3894-
.. _`session.cache-limiter`: https://www.php.net/manual/en/session.configuration.php#ini.session.cache-limiter
3901+
.. _`session.name`: https://www.php.net/manual/en/session.configuration.php#ini.session.name
3902+
.. _`session.cookie_lifetime`: https://www.php.net/manual/en/session.configuration.php#ini.session.cookie-lifetime
3903+
.. _`session.cookie_path`: https://www.php.net/manual/en/session.configuration.php#ini.session.cookie-path
3904+
.. _`session.cache_limiter`: https://www.php.net/manual/en/session.configuration.php#ini.session.cache-limiter
3905+
.. _`session.cookie_domain`: https://www.php.net/manual/en/session.configuration.php#ini.session.cookie-domain
3906+
.. _`session.cookie_samesite`: https://www.php.net/manual/en/session.configuration.php#ini.session.cookie-samesite
3907+
.. _`session.cookie_secure`: https://www.php.net/manual/en/session.configuration.php#ini.session.cookie-secure
3908+
.. _`session.gc_divisor`: https://www.php.net/manual/en/session.configuration.php#ini.session.gc-divisor
3909+
.. _`session.gc_maxlifetime`: https://www.php.net/manual/en/session.configuration.php#ini.session.gc-maxlifetime
3910+
.. _`session.sid_length`: https://www.php.net/manual/en/session.configuration.php#ini.session.sid-length
3911+
.. _`session.sid_bits_per_character`: https://www.php.net/manual/en/session.configuration.php#ini.session.sid-bits-per-character
3912+
.. _`session.save_path`: https://www.php.net/manual/en/session.configuration.php#ini.session.save-path
3913+
.. _`session.use_cookies`: https://www.php.net/manual/en/session.configuration.php#ini.session.use-cookies
38953914
.. _`Microsoft NTLM authentication protocol`: https://docs.microsoft.com/en-us/windows/win32/secauthn/microsoft-ntlm
38963915
.. _`utf-8 modifier`: https://www.php.net/reference.pcre.pattern.modifiers
38973916
.. _`Link HTTP header`: https://tools.ietf.org/html/rfc5988

0 commit comments

Comments
 (0)