Skip to content

Commit 9d87a76

Browse files
authored
Merge pull request #6083 from kenjis/fix-docs-cookie
docs: add about setCookie() prefix details
2 parents 6cab49d + b350c5c commit 9d87a76

5 files changed

Lines changed: 8 additions & 5 deletions

File tree

system/HTTP/ResponseTrait.php

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -543,7 +543,7 @@ public function redirect(string $uri, string $method = 'auto', ?int $code = null
543543
* @param string $expire Cookie expiration time in seconds
544544
* @param string $domain Cookie domain (e.g.: '.yourdomain.com')
545545
* @param string $path Cookie path (default: '/')
546-
* @param string $prefix Cookie name prefix
546+
* @param string $prefix Cookie name prefix ('': the default prefix)
547547
* @param bool $secure Whether to only transfer cookies via SSL
548548
* @param bool $httponly Whether only make the cookie accessible via HTTP (no javascript)
549549
* @param string|null $samesite
@@ -618,6 +618,9 @@ public function hasCookie(string $name, ?string $value = null, string $prefix =
618618
/**
619619
* Returns the cookie
620620
*
621+
* @param string $prefix Cookie prefix.
622+
* '': the default prefix
623+
*
621624
* @return Cookie|Cookie[]|null
622625
*/
623626
public function getCookie(?string $name = null, string $prefix = '')

system/Helpers/cookie_helper.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@
2929
* @param string $expire The number of seconds until expiration
3030
* @param string $domain For site-wide cookie. Usually: .yourdomain.com
3131
* @param string $path The cookie path
32-
* @param string $prefix The cookie prefix
32+
* @param string $prefix The cookie prefix ('': the default prefix)
3333
* @param bool $secure True makes the cookie secure
3434
* @param bool $httpOnly True makes the cookie accessible via http(s) only (no javascript)
3535
* @param string|null $sameSite The cookie SameSite value

user_guide_src/source/helpers/cookie_helper.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ The following functions are available:
2828
:param int $expire: Number of seconds until expiration
2929
:param string $domain: Cookie domain (usually: .yourdomain.com)
3030
:param string $path: Cookie path
31-
:param string $prefix: Cookie name prefix
31+
:param string $prefix: Cookie name prefix. If ``''``, the default from **app/Config/Cookie.php** is used
3232
:param bool $secure: Whether to only send the cookie through HTTPS
3333
:param bool $httpOnly: Whether to hide the cookie from JavaScript
3434
:param string $sameSite: The value for the SameSite cookie parameter. If ``null``, the default from **app/Config/Cookie.php** is used

user_guide_src/source/libraries/cookies/002.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
use CodeIgniter\Cookie\Cookie;
44
use Config\Cookie as CookieConfig;
55

6-
// pass in an Config\Cookie instance before constructing a Cookie class
6+
// pass in a Config\Cookie instance before constructing a Cookie class
77
Cookie::setDefaults(new CookieConfig());
88
$cookie = new Cookie('login_token');
99

user_guide_src/source/outgoing/response.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -367,7 +367,7 @@ The methods provided by the parent class that are available are:
367367
:param int $expire: Cookie expiration time in seconds
368368
:param string $domain: Cookie domain
369369
:param string $path: Cookie path
370-
:param string $prefix: Cookie name prefix
370+
:param string $prefix: Cookie name prefix. If set to ``''``, the default value from **app/Config/Cookie.php** will be used
371371
:param bool $secure: Whether to only transfer the cookie through HTTPS
372372
:param bool $httponly: Whether to only make the cookie accessible for HTTP requests (no JavaScript)
373373
:param string $samesite: The value for the SameSite cookie parameter. If set to ``''``, no SameSite attribute will be set on the cookie. If set to ``null``, the default value from **app/Config/Cookie.php** will be used

0 commit comments

Comments
 (0)