Skip to content

Commit

Permalink
fix: get_cookie() does not take Config\Cookie::$prefix
Browse files Browse the repository at this point in the history
  • Loading branch information
kenjis committed Jun 6, 2022
1 parent 55a6861 commit 57e9237
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion system/Helpers/cookie_helper.php
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 57e9237

Please sign in to comment.