Skip to content

Commit

Permalink
docs: update docs
Browse files Browse the repository at this point in the history
  • Loading branch information
kenjis committed Oct 23, 2023
1 parent cd61c4c commit def9351
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 4 deletions.
11 changes: 11 additions & 0 deletions user_guide_src/source/changelogs/v4.5.0.rst
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,8 @@ Interface Changes
or implemented these interfaces, all these changes are backward compatible
and require no intervention.

- **ResponseInterface:** The default value of the third parameter ``$expire`` of
the ``ResponseInterface::setCookie()`` has been fixed from ``''`` to ``0``.
- **Logger:** The `psr/log <https://packagist.org/packages/psr/log>`_ package has
been upgraded to v2.0.0.

Expand All @@ -65,6 +67,15 @@ Interface Changes
Method Signature Changes
========================

Setting Cookies
---------------

The third parameter ``$expire`` in :php:func:`set_cookie()` and
:php:meth:`CodeIgniter\\HTTP\\Response::setCookie()` has been fixed.

The type has been changed from ``string`` to ``int``, and the default value has
been changed from ``''`` to ``0``.

FileLocatorInterface
--------------------

Expand Down
2 changes: 1 addition & 1 deletion user_guide_src/source/helpers/cookie_helper.rst
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ Available Functions

The following functions are available:

.. php:function:: set_cookie($name[, $value = ''[, $expire = ''[, $domain = ''[, $path = '/'[, $prefix = ''[, $secure = false[, $httpOnly = false[, $sameSite = '']]]]]]]])
.. php:function:: set_cookie($name[, $value = ''[, $expire = 0[, $domain = ''[, $path = '/'[, $prefix = ''[, $secure = false[, $httpOnly = false[, $sameSite = '']]]]]]]])
:param array|Cookie|string $name: Cookie name *or* associative array of all of the parameters available to this function *or* an instance of ``CodeIgniter\Cookie\Cookie``
:param string $value: Cookie value
Expand Down
4 changes: 2 additions & 2 deletions user_guide_src/source/outgoing/response.rst
Original file line number Diff line number Diff line change
Expand Up @@ -453,7 +453,7 @@ The methods provided by the parent class that are available are:
followed by the response body. For the main application response, you do not need to call
this as it is handled automatically by CodeIgniter.

.. php:method:: setCookie($name = ''[, $value = ''[, $expire = ''[, $domain = ''[, $path = '/'[, $prefix = ''[, $secure = false[, $httponly = false[, $samesite = null]]]]]]]])
.. php:method:: setCookie($name = ''[, $value = ''[, $expire = 0[, $domain = ''[, $path = '/'[, $prefix = ''[, $secure = false[, $httponly = false[, $samesite = null]]]]]]]])
:param array|Cookie|string $name: Cookie name *or* associative array of all of the parameters available to this method *or* an instance of ``CodeIgniter\Cookie\Cookie``
:param string $value: Cookie value
Expand Down Expand Up @@ -481,7 +481,7 @@ The methods provided by the parent class that are available are:
.. literalinclude:: response/023.php

Only the ``name`` and ``value`` are required. To delete a cookie set it with the
``expire`` blank.
``value`` blank.

The ``expire`` is set in **seconds**, which will be added to the current
time. Do not include the time, but rather only the number of seconds
Expand Down
2 changes: 1 addition & 1 deletion user_guide_src/source/outgoing/response/023.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
$cookie = [
'name' => 'The Cookie Name',
'value' => 'The Value',
'expire' => '86500',
'expire' => 86500,
'domain' => '.some-domain.com',
'path' => '/',
'prefix' => 'myprefix_',
Expand Down

0 comments on commit def9351

Please sign in to comment.