diff --git a/app/Config/Security.php b/app/Config/Security.php index 0858b9bbb257..635f8b77b9b7 100644 --- a/app/Config/Security.php +++ b/app/Config/Security.php @@ -83,21 +83,4 @@ class Security extends BaseConfig * @see https://codeigniter4.github.io/userguide/libraries/security.html#redirection-on-failure */ public bool $redirect = (ENVIRONMENT === 'production'); - - /** - * -------------------------------------------------------------------------- - * CSRF SameSite - * -------------------------------------------------------------------------- - * - * Setting for CSRF SameSite cookie token. - * - * Allowed values are: None - Lax - Strict - ''. - * - * Defaults to `Lax` as recommended in this link: - * - * @see https://portswigger.net/web-security/csrf/samesite-cookies - * - * @deprecated `Config\Cookie` $samesite property is used. - */ - public string $samesite = 'Lax'; } diff --git a/system/Cookie/CloneableCookieInterface.php b/system/Cookie/CloneableCookieInterface.php index 0b7d6fdf5015..3055129a0b4b 100644 --- a/system/Cookie/CloneableCookieInterface.php +++ b/system/Cookie/CloneableCookieInterface.php @@ -58,15 +58,6 @@ public function withExpires($expires); */ public function withExpired(); - /** - * Creates a new Cookie that will virtually never expire from the browser. - * - * @return static - * - * @deprecated See https://github.com/codeigniter4/CodeIgniter4/pull/6413 - */ - public function withNeverExpiring(); - /** * Creates a new Cookie with a new path on the server the cookie is available. * diff --git a/system/Cookie/Cookie.php b/system/Cookie/Cookie.php index 468254f65336..df75c03c7bcb 100644 --- a/system/Cookie/Cookie.php +++ b/system/Cookie/Cookie.php @@ -465,18 +465,6 @@ public function withExpired() return $cookie; } - /** - * @deprecated See https://github.com/codeigniter4/CodeIgniter4/pull/6413 - */ - public function withNeverExpiring() - { - $cookie = clone $this; - - $cookie->expires = Time::now()->getTimestamp() + 5 * YEAR; - - return $cookie; - } - /** * {@inheritDoc} */ diff --git a/system/Cookie/CookieStore.php b/system/Cookie/CookieStore.php index 05ebf9925ee6..6d5caa2aa5e0 100644 --- a/system/Cookie/CookieStore.php +++ b/system/Cookie/CookieStore.php @@ -159,28 +159,6 @@ public function remove(string $name, string $prefix = '') return $store; } - /** - * Dispatches all cookies in store. - * - * @deprecated Response should dispatch cookies. - */ - public function dispatch(): void - { - foreach ($this->cookies as $cookie) { - $name = $cookie->getPrefixedName(); - $value = $cookie->getValue(); - $options = $cookie->getOptions(); - - if ($cookie->isRaw()) { - $this->setRawCookie($name, $value, $options); - } else { - $this->setCookie($name, $value, $options); - } - } - - $this->clear(); - } - /** * Returns all cookie instances in store. * @@ -232,28 +210,4 @@ protected function validateCookies(array $cookies): void } } } - - /** - * Extracted call to `setrawcookie()` in order to run unit tests on it. - * - * @codeCoverageIgnore - * - * @deprecated - */ - protected function setRawCookie(string $name, string $value, array $options): void - { - setrawcookie($name, $value, $options); - } - - /** - * Extracted call to `setcookie()` in order to run unit tests on it. - * - * @codeCoverageIgnore - * - * @deprecated - */ - protected function setCookie(string $name, string $value, array $options): void - { - setcookie($name, $value, $options); - } } diff --git a/tests/system/Cookie/CookieTest.php b/tests/system/Cookie/CookieTest.php index 7f98e5e1e0b0..e4421a8bc443 100644 --- a/tests/system/Cookie/CookieTest.php +++ b/tests/system/Cookie/CookieTest.php @@ -235,7 +235,6 @@ public function testCloningCookies(): void $e = $a->withValue('muffin'); $f = $a->withExpires('+30 days'); $g = $a->withExpired(); - $h = $a->withNeverExpiring(); $i = $a->withDomain('localhost'); $j = $a->withPath('/web'); $k = $a->withSecure(); @@ -248,7 +247,6 @@ public function testCloningCookies(): void $this->assertNotSame($a, $e); $this->assertNotSame($a, $f); $this->assertNotSame($a, $g); - $this->assertNotSame($a, $h); $this->assertNotSame($a, $i); $this->assertNotSame($a, $j); $this->assertNotSame($a, $k); diff --git a/user_guide_src/source/changelogs/v4.6.0.rst b/user_guide_src/source/changelogs/v4.6.0.rst index 85901cd52743..91f61f5a6a2a 100644 --- a/user_guide_src/source/changelogs/v4.6.0.rst +++ b/user_guide_src/source/changelogs/v4.6.0.rst @@ -203,6 +203,8 @@ Removed Deprecated Items - **View:** The deprecated property ``CodeIgniter\View\View::$currentSection`` has been removed. - **Config:** The deprecated property ``Config\Cache::$storePath`` has been removed. Use ``Config\Cache::$file['storePath']`` instead. - **Formatter:** The deprecated ``Config\Format::getFormatter()`` has been removed. Use ``CodeIgniter\Format\Format::getFormatter()`` instead. +- **Security:** ``Config\Security::$samesite`` has been removed. Use ``Config\Cookie::$samesite`` instead. +- **Cookie:** Methods ``dispatch()``, ``setRawCookie()``, ``setCookie()`` in ``CodeIgniter\Cookie\CookieStore`` has been removed. They are now part of ``CodeIgniter\HTTP\ResponseTrait``. ************ Enhancements diff --git a/user_guide_src/source/libraries/cookies.rst b/user_guide_src/source/libraries/cookies.rst index c6ac80706829..00239b0911f7 100644 --- a/user_guide_src/source/libraries/cookies.rst +++ b/user_guide_src/source/libraries/cookies.rst @@ -228,9 +228,7 @@ the instance with the modified instance. Dispatching Cookies in Store ============================ -.. deprecated:: 4.1.6 - -.. important:: This method is deprecated. It will be removed in future releases. +.. important:: This method was deprecated as of version 4.1.6 and was removed in 4.6.0. More often than not, you do not need to concern yourself in manually sending cookies. CodeIgniter will do this for you. However, if you really need to manually send cookies, you can use the ``dispatch`` method. Just like @@ -369,9 +367,7 @@ Class Reference .. php:method:: withNeverExpiring() - .. deprecated:: 4.2.6 - - .. important:: This method is deprecated. It will be removed in future releases. + .. important:: This method was deprecated as of version 4.2.6 and was removed in 4.6.0. :param string $name: :rtype: ``Cookie`` @@ -484,6 +480,8 @@ Class Reference .. php:method:: dispatch(): void + .. important:: This method was deprecated as of version 4.1.6 and was removed in 4.6.0. + :rtype: void Dispatches all cookies in store. diff --git a/utils/phpstan-baseline/missingType.iterableValue.neon b/utils/phpstan-baseline/missingType.iterableValue.neon index efa0cdea552b..8a99113f5f0f 100644 --- a/utils/phpstan-baseline/missingType.iterableValue.neon +++ b/utils/phpstan-baseline/missingType.iterableValue.neon @@ -1,4 +1,4 @@ -# total 1667 errors +# total 1665 errors parameters: ignoreErrors: @@ -852,16 +852,6 @@ parameters: count: 1 path: ../../system/Controller.php - - - message: '#^Method CodeIgniter\\Cookie\\CookieStore\:\:setCookie\(\) has parameter \$options with no value type specified in iterable type array\.$#' - count: 1 - path: ../../system/Cookie/CookieStore.php - - - - message: '#^Method CodeIgniter\\Cookie\\CookieStore\:\:setRawCookie\(\) has parameter \$options with no value type specified in iterable type array\.$#' - count: 1 - path: ../../system/Cookie/CookieStore.php - - message: '#^Method CodeIgniter\\Cookie\\CookieStore\:\:validateCookies\(\) has parameter \$cookies with no value type specified in iterable type array\.$#' count: 1