@@ -1618,38 +1618,39 @@ You can also :ref:`store sessions in a database <session-database>`.
1618
1618
name
1619
1619
....
1620
1620
1621
- **type **: ``string `` **default **: ``null ``
1621
+ **type **: ``string ``
1622
+
1623
+ This specifies the name of the session cookie.
1622
1624
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.
1626
1626
1627
1627
cookie_lifetime
1628
1628
...............
1629
1629
1630
- **type **: ``integer `` ** default **: `` null ``
1630
+ **type **: ``integer ``
1631
1631
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
1635
1634
the length of the browser session.
1636
1635
1636
+ If not set, ``php.ini ``'s `session.cookie_lifetime `_ directive will be relied on.
1637
+
1637
1638
cookie_path
1638
1639
...........
1639
1640
1640
- **type **: ``string `` **default **: ``/ ``
1641
+ **type **: ``string ``
1642
+
1643
+ This determines the path to set in the session cookie.
1641
1644
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.
1644
1646
1645
1647
cache_limiter
1646
1648
.............
1647
1649
1648
- **type **: ``string `` or `` int `` **default **: ``'' ``
1650
+ **type **: ``string `` **default **: ``0 ``
1649
1651
1650
1652
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.
1653
1654
1654
1655
Unlike the other session options, ``cache_limiter `` is set as a regular
1655
1656
:ref: `container parameter <configuration-parameters >`:
@@ -1686,19 +1687,22 @@ Unlike the other session options, ``cache_limiter`` is set as a regular
1686
1687
'cache_limiter' => 0,
1687
1688
]);
1688
1689
1690
+ Be aware that if you configure it, you'll have to set other session-related options
1691
+ as parameters as well.
1692
+
1689
1693
cookie_domain
1690
1694
.............
1691
1695
1692
- **type **: ``string `` **default **: ``'' ``
1696
+ **type **: ``string ``
1697
+
1698
+ This determines the domain to set in the session cookie.
1693
1699
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.
1697
1701
1698
1702
cookie_samesite
1699
1703
...............
1700
1704
1701
- **type **: ``string `` or ``null `` **default **: ``lax ``
1705
+ **type **: ``string `` or ``null `` **default **: ``null ``
1702
1706
1703
1707
It controls the way cookies are sent when the HTTP request did not originate
1704
1708
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.
1712
1716
1713
1717
The possible values for this option are:
1714
1718
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.
1717
1720
* ``'none' `` (or the ``Symfony\Component\HttpFoundation\Cookie::SAMESITE_NONE `` constant), use it to allow
1718
1721
sending of cookies when the HTTP request originated from a different domain
1719
1722
(previously this was the default behavior of null, but in newer browsers ``'lax' ``
@@ -1727,18 +1730,20 @@ The possible values for this option are:
1727
1730
1728
1731
.. note ::
1729
1732
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.
1732
1735
1733
1736
cookie_secure
1734
1737
.............
1735
1738
1736
- **type **: ``boolean `` or ``'auto' `` ** default **: `` auto ``
1739
+ **type **: ``boolean `` or ``'auto' ``
1737
1740
1738
1741
This determines whether cookies should only be sent over secure connections. In
1739
1742
addition to ``true `` and ``false ``, there's a special ``'auto' `` value that
1740
1743
means ``true `` for HTTPS requests and ``false `` for HTTP requests.
1741
1744
1745
+ If not set, ``php.ini ``'s `session.cookie_secure `_ directive will be relied on.
1746
+
1742
1747
cookie_httponly
1743
1748
...............
1744
1749
@@ -1752,10 +1757,12 @@ identity theft through XSS attacks.
1752
1757
gc_divisor
1753
1758
..........
1754
1759
1755
- **type **: ``integer `` ** default **: `` 100 ``
1760
+ **type **: ``integer ``
1756
1761
1757
1762
See `gc_probability `_.
1758
1763
1764
+ If not set, ``php.ini ``'s `session.gc_divisor `_ directive will be relied on.
1765
+
1759
1766
gc_probability
1760
1767
..............
1761
1768
@@ -1769,45 +1776,46 @@ chance that the GC process will start on each request.
1769
1776
gc_maxlifetime
1770
1777
..............
1771
1778
1772
- **type **: ``integer `` ** default **: `` 1440 ``
1779
+ **type **: ``integer ``
1773
1780
1774
1781
This determines the number of seconds after which data will be seen as "garbage"
1775
1782
and potentially cleaned up. Garbage collection may occur during session
1776
1783
start and depends on `gc_divisor `_ and `gc_probability `_.
1777
1784
1785
+ If not set, ``php.ini ``'s `session.gc_maxlifetime `_ directive will be relied on.
1786
+
1778
1787
sid_length
1779
1788
..........
1780
1789
1781
- **type **: ``integer `` ** default **: `` 32 ``
1790
+ **type **: ``integer ``
1782
1791
1783
1792
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
1785
1794
session IDs are harder to guess.
1786
1795
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 .
1788
1797
1789
1798
sid_bits_per_character
1790
1799
......................
1791
1800
1792
- **type **: ``integer `` ** default **: `` 4 ``
1801
+ **type **: ``integer ``
1793
1802
1794
1803
This determines the number of bits in the encoded session ID character. The possible
1795
1804
values are ``4 `` (0-9, a-f), ``5 `` (0-9, a-v), and ``6 `` (0-9, a-z, A-Z, "-", ",").
1796
1805
The more bits results in stronger session ID. ``5 `` is recommended value for
1797
1806
most environments.
1798
1807
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 .
1800
1809
1801
1810
save_path
1802
1811
.........
1803
1812
1804
- **type **: ``string `` **default **: ``%kernel.cache_dir%/sessions ``
1813
+ **type **: ``string `` or `` null `` **default **: ``%kernel.cache_dir%/sessions ``
1805
1814
1806
1815
This determines the argument to be passed to the save handler. If you choose
1807
1816
the default file handler, this is the path where the session files are created.
1808
1817
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:
1811
1819
1812
1820
.. configuration-block ::
1813
1821
@@ -1902,11 +1910,12 @@ Whether to enable the session support in the framework.
1902
1910
use_cookies
1903
1911
...........
1904
1912
1905
- **type **: ``boolean `` ** default **: `` null ``
1913
+ **type **: ``boolean ``
1906
1914
1907
1915
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.
1910
1919
1911
1920
ssi
1912
1921
~~~
@@ -3699,14 +3708,24 @@ use the configuration of the first exception that matches ``instanceof``:
3699
3708
.. _`json_encode flags bitmask` : https://www.php.net/json_encode
3700
3709
.. _`error_reporting PHP option` : https://www.php.net/manual/en/errorfunc.configuration.php#ini.error-reporting
3701
3710
.. _`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
3704
3711
.. _`X-Robots-Tag HTTP header` : https://developers.google.com/search/reference/robots_meta_tag
3705
3712
.. _`RFC 3986` : https://www.ietf.org/rfc/rfc3986.txt
3706
3713
.. _`default_socket_timeout` : https://www.php.net/manual/en/filesystem.configuration.php#ini.default-socket-timeout
3707
3714
.. _`PEM formatted` : https://en.wikipedia.org/wiki/Privacy-Enhanced_Mail
3708
3715
.. _`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
3710
3729
.. _`Microsoft NTLM authentication protocol` : https://docs.microsoft.com/en-us/windows/win32/secauthn/microsoft-ntlm
3711
3730
.. _`utf-8 modifier` : https://www.php.net/reference.pcre.pattern.modifiers
3712
3731
.. _`Link HTTP header` : https://tools.ietf.org/html/rfc5988
0 commit comments