Skip to content

Commit

Permalink
Merge pull request #6080 from kenjis/fix-get_cookie-ignores-ConfigCookie
Browse files Browse the repository at this point in the history
fix: get_cookie() does not take Config\Cookie::$prefix
  • Loading branch information
kenjis authored Jun 7, 2022
2 parents 3e7f640 + 57e9237 commit a1c7ca2
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion system/Helpers/cookie_helper.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
*/

use Config\App;
use Config\Cookie;
use Config\Services;

//=============================================================================
Expand Down Expand Up @@ -63,7 +64,13 @@ function set_cookie(
*/
function get_cookie($index, bool $xssClean = false)
{
$prefix = isset($_COOKIE[$index]) ? '' : config(App::class)->cookiePrefix;
/** @var Cookie|null $cookie */
$cookie = config('Cookie');

// @TODO Remove Config\App fallback when deprecated `App` members are removed.
$cookiePrefix = $cookie instanceof Cookie ? $cookie->prefix : config(App::class)->cookiePrefix;

$prefix = isset($_COOKIE[$index]) ? '' : $cookiePrefix;
$request = Services::request();
$filter = $xssClean ? FILTER_SANITIZE_FULL_SPECIAL_CHARS : FILTER_DEFAULT;

Expand Down

0 comments on commit a1c7ca2

Please sign in to comment.