@@ -1589,38 +1589,39 @@ You can also :ref:`store sessions in a database <session-database>`.
1589
1589
name
1590
1590
....
1591
1591
1592
- **type **: ``string `` **default **: ``null ``
1592
+ **type **: ``string ``
1593
+
1594
+ This specifies the name of the session cookie.
1593
1595
1594
- This specifies the name of the session cookie. By default, it will use the
1595
- cookie name which is defined in the ``php.ini `` with the ``session.name ``
1596
- directive.
1596
+ If not set, ``php.ini ``'s `session.name `_ directive will be relied on.
1597
1597
1598
1598
cookie_lifetime
1599
1599
...............
1600
1600
1601
- **type **: ``integer `` ** default **: `` null ``
1601
+ **type **: ``integer ``
1602
1602
1603
- This determines the lifetime of the session - in seconds. The default value
1604
- - ``null `` - means that the ``session.cookie_lifetime `` value from ``php.ini ``
1605
- will be used. Setting this value to ``0 `` means the cookie is valid for
1603
+ This determines the lifetime of the session - in seconds.
1604
+ Setting this value to ``0 `` means the cookie is valid for
1606
1605
the length of the browser session.
1607
1606
1607
+ If not set, ``php.ini ``'s `session.cookie_lifetime `_ directive will be relied on.
1608
+
1608
1609
cookie_path
1609
1610
...........
1610
1611
1611
- **type **: ``string `` **default **: ``/ ``
1612
+ **type **: ``string ``
1613
+
1614
+ This determines the path to set in the session cookie.
1612
1615
1613
- This determines the path to set in the session cookie. By default, it will
1614
- use ``/ ``.
1616
+ If not set, ``php.ini ``'s `session.cookie_path `_ directive will be relied on.
1615
1617
1616
1618
cache_limiter
1617
1619
.............
1618
1620
1619
- **type **: ``string `` or `` int `` **default **: ``'' ``
1621
+ **type **: ``string `` **default **: ``'0 ' ``
1620
1622
1621
- If set to ``0 ``, Symfony won't set any particular header related to the cache
1622
- and it will rely on the cache control method configured in the
1623
- `session.cache-limiter `_ PHP.ini option.
1623
+ If set to ``'0' ``, Symfony won't set any particular header related to the cache
1624
+ and it will rely on ``php.ini ``'s `session.cache_limiter `_ directive.
1624
1625
1625
1626
Unlike the other session options, ``cache_limiter `` is set as a regular
1626
1627
:ref: `container parameter <configuration-parameters >`:
@@ -1657,19 +1658,22 @@ Unlike the other session options, ``cache_limiter`` is set as a regular
1657
1658
'cache_limiter' => 0,
1658
1659
]);
1659
1660
1661
+ Be aware that if you configure it, you'll have to set other session-related options
1662
+ as parameters as well.
1663
+
1660
1664
cookie_domain
1661
1665
.............
1662
1666
1663
- **type **: ``string `` **default **: ``'' ``
1667
+ **type **: ``string ``
1668
+
1669
+ This determines the domain to set in the session cookie.
1664
1670
1665
- This determines the domain to set in the session cookie. By default, it's
1666
- blank, meaning the host name of the server which generated the cookie according
1667
- to the cookie specification.
1671
+ If not set, ``php.ini ``'s `session.cookie_domain `_ directive will be relied on.
1668
1672
1669
1673
cookie_samesite
1670
1674
...............
1671
1675
1672
- **type **: ``string `` or ``null `` **default **: ``'lax' ``
1676
+ **type **: ``string `` or ``null `` **default **: ``null ``
1673
1677
1674
1678
It controls the way cookies are sent when the HTTP request did not originate
1675
1679
from the same domain that is associated with the cookies. Setting this option is
@@ -1683,8 +1687,7 @@ those cookies when making that HTTP request.
1683
1687
1684
1688
The possible values for this option are:
1685
1689
1686
- * ``null ``, use it to disable this protection. Same behavior as in older Symfony
1687
- versions.
1690
+ * ``null ``, use ``php.ini ``'s `session.cookie_samesite `_ directive.
1688
1691
* ``'none' `` (or the ``Symfony\Component\HttpFoundation\Cookie::SAMESITE_NONE `` constant), use it to allow
1689
1692
sending of cookies when the HTTP request originated from a different domain
1690
1693
(previously this was the default behavior of null, but in newer browsers ``'lax' ``
@@ -1698,18 +1701,20 @@ The possible values for this option are:
1698
1701
1699
1702
.. note ::
1700
1703
1701
- This option is available starting from PHP 7.3, but Symfony has a polyfill
1702
- so you can use it with any older PHP version as well.
1704
+ Same-site cookies are a PHP 7.3 feature , but Symfony has a polyfill
1705
+ so you can set this option with any older PHP version as well.
1703
1706
1704
1707
cookie_secure
1705
1708
.............
1706
1709
1707
- **type **: ``boolean `` or ``'auto' `` ** default **: `` 'auto' ``
1710
+ **type **: ``boolean `` or ``'auto' ``
1708
1711
1709
1712
This determines whether cookies should only be sent over secure connections. In
1710
1713
addition to ``true `` and ``false ``, there's a special ``'auto' `` value that
1711
1714
means ``true `` for HTTPS requests and ``false `` for HTTP requests.
1712
1715
1716
+ If not set, ``php.ini ``'s `session.cookie_secure `_ directive will be relied on.
1717
+
1713
1718
cookie_httponly
1714
1719
...............
1715
1720
@@ -1723,10 +1728,12 @@ identity theft through XSS attacks.
1723
1728
gc_divisor
1724
1729
..........
1725
1730
1726
- **type **: ``integer `` ** default **: `` 100 ``
1731
+ **type **: ``integer ``
1727
1732
1728
1733
See `gc_probability `_.
1729
1734
1735
+ If not set, ``php.ini ``'s `session.gc_divisor `_ directive will be relied on.
1736
+
1730
1737
gc_probability
1731
1738
..............
1732
1739
@@ -1740,45 +1747,46 @@ chance that the GC process will start on each request.
1740
1747
gc_maxlifetime
1741
1748
..............
1742
1749
1743
- **type **: ``integer `` ** default **: `` 1440 ``
1750
+ **type **: ``integer ``
1744
1751
1745
1752
This determines the number of seconds after which data will be seen as "garbage"
1746
1753
and potentially cleaned up. Garbage collection may occur during session
1747
1754
start and depends on `gc_divisor `_ and `gc_probability `_.
1748
1755
1756
+ If not set, ``php.ini ``'s `session.gc_maxlifetime `_ directive will be relied on.
1757
+
1749
1758
sid_length
1750
1759
..........
1751
1760
1752
- **type **: ``integer `` ** default **: `` 32 ``
1761
+ **type **: ``integer ``
1753
1762
1754
1763
This determines the length of session ID string, which can be an integer between
1755
- ``22 `` and ``256 `` (both inclusive), being ``32 `` the recommended value. Longer
1764
+ ``22 `` and ``256 `` (both inclusive), ``32 `` being the recommended value. Longer
1756
1765
session IDs are harder to guess.
1757
1766
1758
- This option is related to the `session.sid_length PHP option `_ .
1767
+ If not set, `` php.ini ``'s `session.sid_length `_ directive will be relied on .
1759
1768
1760
1769
sid_bits_per_character
1761
1770
......................
1762
1771
1763
- **type **: ``integer `` ** default **: `` 4 ``
1772
+ **type **: ``integer ``
1764
1773
1765
1774
This determines the number of bits in the encoded session ID character. The possible
1766
1775
values are ``4 `` (0-9, a-f), ``5 `` (0-9, a-v), and ``6 `` (0-9, a-z, A-Z, "-", ",").
1767
1776
The more bits results in stronger session ID. ``5 `` is recommended value for
1768
1777
most environments.
1769
1778
1770
- This option is related to the `session.sid_bits_per_character PHP option `_ .
1779
+ If not set, `` php.ini ``'s `session.sid_bits_per_character `_ directive will be relied on .
1771
1780
1772
1781
save_path
1773
1782
.........
1774
1783
1775
- **type **: ``string `` **default **: ``%kernel.cache_dir%/sessions ``
1784
+ **type **: ``string `` or `` null `` **default **: ``%kernel.cache_dir%/sessions ``
1776
1785
1777
1786
This determines the argument to be passed to the save handler. If you choose
1778
1787
the default file handler, this is the path where the session files are created.
1779
1788
1780
- You can also set this value to the ``save_path `` of your ``php.ini `` by
1781
- setting the value to ``null ``:
1789
+ If ``null ``, ``php.ini ``'s `session.save_path `_ directive will be relied on:
1782
1790
1783
1791
.. configuration-block ::
1784
1792
@@ -1873,11 +1881,12 @@ Whether to enable the session support in the framework.
1873
1881
use_cookies
1874
1882
...........
1875
1883
1876
- **type **: ``boolean `` ** default **: `` null ``
1884
+ **type **: ``boolean ``
1877
1885
1878
1886
This specifies if the session ID is stored on the client side using cookies or
1879
- not. By default, it will use the value defined in the ``php.ini `` with the
1880
- ``session.use_cookies `` directive.
1887
+ not.
1888
+
1889
+ If not set, ``php.ini ``'s `session.use_cookies `_ directive will be relied on.
1881
1890
1882
1891
assets
1883
1892
~~~~~~
@@ -3628,14 +3637,24 @@ use the configuration of the first exception that matches ``instanceof``:
3628
3637
.. _`json_encode flags bitmask` : https://www.php.net/json_encode
3629
3638
.. _`error_reporting PHP option` : https://www.php.net/manual/en/errorfunc.configuration.php#ini.error-reporting
3630
3639
.. _`CSRF security attacks` : https://en.wikipedia.org/wiki/Cross-site_request_forgery
3631
- .. _`session.sid_length PHP option` : https://www.php.net/manual/session.configuration.php#ini.session.sid-length
3632
- .. _`session.sid_bits_per_character PHP option` : https://www.php.net/manual/session.configuration.php#ini.session.sid-bits-per-character
3633
3640
.. _`X-Robots-Tag HTTP header` : https://developers.google.com/search/reference/robots_meta_tag
3634
3641
.. _`RFC 3986` : https://www.ietf.org/rfc/rfc3986.txt
3635
3642
.. _`default_socket_timeout` : https://www.php.net/manual/en/filesystem.configuration.php#ini.default-socket-timeout
3636
3643
.. _`PEM formatted` : https://en.wikipedia.org/wiki/Privacy-Enhanced_Mail
3637
3644
.. _`haveibeenpwned.com` : https://haveibeenpwned.com/
3638
- .. _`session.cache-limiter` : https://www.php.net/manual/en/session.configuration.php#ini.session.cache-limiter
3645
+ .. _`session.name` : https://www.php.net/manual/en/session.configuration.php#ini.session.name
3646
+ .. _`session.cookie_lifetime` : https://www.php.net/manual/en/session.configuration.php#ini.session.cookie-lifetime
3647
+ .. _`session.cookie_path` : https://www.php.net/manual/en/session.configuration.php#ini.session.cookie-path
3648
+ .. _`session.cache_limiter` : https://www.php.net/manual/en/session.configuration.php#ini.session.cache-limiter
3649
+ .. _`session.cookie_domain` : https://www.php.net/manual/en/session.configuration.php#ini.session.cookie-domain
3650
+ .. _`session.cookie_samesite` : https://www.php.net/manual/en/session.configuration.php#ini.session.cookie-samesite
3651
+ .. _`session.cookie_secure` : https://www.php.net/manual/en/session.configuration.php#ini.session.cookie-secure
3652
+ .. _`session.gc_divisor` : https://www.php.net/manual/en/session.configuration.php#ini.session.gc-divisor
3653
+ .. _`session.gc_maxlifetime` : https://www.php.net/manual/en/session.configuration.php#ini.session.gc-maxlifetime
3654
+ .. _`session.sid_length` : https://www.php.net/manual/en/session.configuration.php#ini.session.sid-length
3655
+ .. _`session.sid_bits_per_character` : https://www.php.net/manual/en/session.configuration.php#ini.session.sid-bits-per-character
3656
+ .. _`session.save_path` : https://www.php.net/manual/en/session.configuration.php#ini.session.save-path
3657
+ .. _`session.use_cookies` : https://www.php.net/manual/en/session.configuration.php#ini.session.use-cookies
3639
3658
.. _`Microsoft NTLM authentication protocol` : https://docs.microsoft.com/en-us/windows/win32/secauthn/microsoft-ntlm
3640
3659
.. _`utf-8 modifier` : https://www.php.net/reference.pcre.pattern.modifiers
3641
3660
.. _`Link HTTP header` : https://tools.ietf.org/html/rfc5988
0 commit comments