@@ -1586,38 +1586,39 @@ You can also :ref:`store sessions in a database <session-database>`.
1586
1586
name
1587
1587
....
1588
1588
1589
- **type **: ``string `` **default **: ``null ``
1589
+ **type **: ``string ``
1590
+
1591
+ This specifies the name of the session cookie.
1590
1592
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.
1594
1594
1595
1595
cookie_lifetime
1596
1596
...............
1597
1597
1598
- **type **: ``integer `` ** default **: `` null ``
1598
+ **type **: ``integer ``
1599
1599
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
1603
1602
the length of the browser session.
1604
1603
1604
+ If not set, ``php.ini ``'s `session.cookie_lifetime `_ directive will be relied on.
1605
+
1605
1606
cookie_path
1606
1607
...........
1607
1608
1608
- **type **: ``string `` **default **: ``/ ``
1609
+ **type **: ``string ``
1610
+
1611
+ This determines the path to set in the session cookie.
1609
1612
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.
1612
1614
1613
1615
cache_limiter
1614
1616
.............
1615
1617
1616
- **type **: ``string `` or `` int `` **default **: ``'' ``
1618
+ **type **: ``string `` **default **: ``0 ``
1617
1619
1618
1620
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.
1621
+ and it will rely on ``php.ini ``'s `session.cache_limiter `_ directive.
1621
1622
1622
1623
Unlike the other session options, ``cache_limiter `` is set as a regular
1623
1624
:ref: `container parameter <configuration-parameters >`:
@@ -1654,19 +1655,22 @@ Unlike the other session options, ``cache_limiter`` is set as a regular
1654
1655
'cache_limiter' => 0,
1655
1656
]);
1656
1657
1658
+ Be aware that if you configure it, you'll have to set other session-related options
1659
+ as parameters as well.
1660
+
1657
1661
cookie_domain
1658
1662
.............
1659
1663
1660
- **type **: ``string `` **default **: ``'' ``
1664
+ **type **: ``string ``
1665
+
1666
+ This determines the domain to set in the session cookie.
1661
1667
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.
1665
1669
1666
1670
cookie_samesite
1667
1671
...............
1668
1672
1669
- **type **: ``string `` or ``null `` **default **: ``lax ``
1673
+ **type **: ``string `` or ``null `` **default **: ``null ``
1670
1674
1671
1675
It controls the way cookies are sent when the HTTP request did not originate
1672
1676
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.
1680
1684
1681
1685
The possible values for this option are:
1682
1686
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.
1685
1688
* ``'none' `` (or the ``Symfony\Component\HttpFoundation\Cookie::SAMESITE_NONE `` constant), use it to allow
1686
1689
sending of cookies when the HTTP request originated from a different domain
1687
1690
(previously this was the default behavior of null, but in newer browsers ``'lax' ``
@@ -1695,18 +1698,20 @@ The possible values for this option are:
1695
1698
1696
1699
.. note ::
1697
1700
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.
1700
1703
1701
1704
cookie_secure
1702
1705
.............
1703
1706
1704
- **type **: ``boolean `` or ``'auto' `` ** default **: `` auto ``
1707
+ **type **: ``boolean `` or ``auto ``
1705
1708
1706
1709
This determines whether cookies should only be sent over secure connections. In
1707
1710
addition to ``true `` and ``false ``, there's a special ``'auto' `` value that
1708
1711
means ``true `` for HTTPS requests and ``false `` for HTTP requests.
1709
1712
1713
+ If not set, ``php.ini ``'s `session.cookie_secure `_ directive will be relied on.
1714
+
1710
1715
cookie_httponly
1711
1716
...............
1712
1717
@@ -1720,10 +1725,12 @@ identity theft through XSS attacks.
1720
1725
gc_divisor
1721
1726
..........
1722
1727
1723
- **type **: ``integer `` ** default **: `` 100 ``
1728
+ **type **: ``integer ``
1724
1729
1725
1730
See `gc_probability `_.
1726
1731
1732
+ If not set, ``php.ini ``'s `session.gc_divisor `_ directive will be relied on.
1733
+
1727
1734
gc_probability
1728
1735
..............
1729
1736
@@ -1737,45 +1744,46 @@ chance that the GC process will start on each request.
1737
1744
gc_maxlifetime
1738
1745
..............
1739
1746
1740
- **type **: ``integer `` ** default **: `` 1440 ``
1747
+ **type **: ``integer ``
1741
1748
1742
1749
This determines the number of seconds after which data will be seen as "garbage"
1743
1750
and potentially cleaned up. Garbage collection may occur during session
1744
1751
start and depends on `gc_divisor `_ and `gc_probability `_.
1745
1752
1753
+ If not set, ``php.ini ``'s `session.gc_maxlifetime `_ directive will be relied on.
1754
+
1746
1755
sid_length
1747
1756
..........
1748
1757
1749
- **type **: ``integer `` ** default **: `` 32 ``
1758
+ **type **: ``integer ``
1750
1759
1751
1760
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
1753
1762
session IDs are harder to guess.
1754
1763
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 .
1756
1765
1757
1766
sid_bits_per_character
1758
1767
......................
1759
1768
1760
- **type **: ``integer `` ** default **: `` 4 ``
1769
+ **type **: ``integer ``
1761
1770
1762
1771
This determines the number of bits in the encoded session ID character. The possible
1763
1772
values are ``4 `` (0-9, a-f), ``5 `` (0-9, a-v), and ``6 `` (0-9, a-z, A-Z, "-", ",").
1764
1773
The more bits results in stronger session ID. ``5 `` is recommended value for
1765
1774
most environments.
1766
1775
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 .
1768
1777
1769
1778
save_path
1770
1779
.........
1771
1780
1772
- **type **: ``string `` **default **: ``%kernel.cache_dir%/sessions ``
1781
+ **type **: ``string `` or `` null `` **default **: ``%kernel.cache_dir%/sessions ``
1773
1782
1774
1783
This determines the argument to be passed to the save handler. If you choose
1775
1784
the default file handler, this is the path where the session files are created.
1776
1785
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:
1779
1787
1780
1788
.. configuration-block ::
1781
1789
@@ -1870,11 +1878,12 @@ Whether to enable the session support in the framework.
1870
1878
use_cookies
1871
1879
...........
1872
1880
1873
- **type **: ``boolean `` ** default **: `` null ``
1881
+ **type **: ``boolean ``
1874
1882
1875
1883
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.
1878
1887
1879
1888
assets
1880
1889
~~~~~~
@@ -3636,14 +3645,24 @@ use the configuration of the first exception that matches ``instanceof``:
3636
3645
.. _`json_encode flags bitmask` : https://www.php.net/json_encode
3637
3646
.. _`error_reporting PHP option` : https://www.php.net/manual/en/errorfunc.configuration.php#ini.error-reporting
3638
3647
.. _`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
3641
3648
.. _`X-Robots-Tag HTTP header` : https://developers.google.com/search/reference/robots_meta_tag
3642
3649
.. _`RFC 3986` : https://www.ietf.org/rfc/rfc3986.txt
3643
3650
.. _`default_socket_timeout` : https://www.php.net/manual/en/filesystem.configuration.php#ini.default-socket-timeout
3644
3651
.. _`PEM formatted` : https://en.wikipedia.org/wiki/Privacy-Enhanced_Mail
3645
3652
.. _`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
3647
3666
.. _`Microsoft NTLM authentication protocol` : https://docs.microsoft.com/en-us/windows/win32/secauthn/microsoft-ntlm
3648
3667
.. _`utf-8 modifier` : https://www.php.net/reference.pcre.pattern.modifiers
3649
3668
.. _`Link HTTP header` : https://tools.ietf.org/html/rfc5988
0 commit comments