Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixes issue with compatibility to work with CodeIgniter 4.4+ #612

Merged
merged 2 commits into from
Jan 11, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 21 additions & 0 deletions src/Authentication/AuthenticationBase.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

namespace Myth\Auth\Authentication;

use CodeIgniter\CodeIgniter;
use CodeIgniter\Events\Events;
use CodeIgniter\Model;
use Exception;
Expand Down Expand Up @@ -222,6 +223,16 @@
$appConfig = config('App');
$response = service('response');

// Replace cookie config values from cookie.php file on new versions of CI (v4.4.0 and above) for BC.
if (version_compare(CodeIgniter::CI_VERSION, '4.3.8', '>')) {

Check failure on line 227 in src/Authentication/AuthenticationBase.php

View workflow job for this annotation

GitHub Actions / PHP 8.0 Static Analysis

If condition is always true.

Check failure on line 227 in src/Authentication/AuthenticationBase.php

View workflow job for this annotation

GitHub Actions / PHP 8.1 Static Analysis

If condition is always true.

Check failure on line 227 in src/Authentication/AuthenticationBase.php

View workflow job for this annotation

GitHub Actions / PHP 7.4 Static Analysis

If condition is always true.
$cookieConfig = config('Cookie');
$appConfig->cookieDomain = $cookieConfig->domain;
$appConfig->cookiePath = $cookieConfig->path;
$appConfig->cookiePrefix = $cookieConfig->prefix;
$appConfig->cookieSecure = $cookieConfig->secure;
$appConfig->cookieHTTPOnly = $cookieConfig->httponly;
}

// Create the cookie
$response->setCookie(
'remember', // Cookie Name
Expand Down Expand Up @@ -259,6 +270,16 @@

$appConfig = config('App');

// Replace cookie config values from cookie.php file on new versions of CI (v4.4.0 and above) for BC.
if (version_compare(CodeIgniter::CI_VERSION, '4.3.8', '>')) {

Check failure on line 274 in src/Authentication/AuthenticationBase.php

View workflow job for this annotation

GitHub Actions / PHP 8.0 Static Analysis

If condition is always true.

Check failure on line 274 in src/Authentication/AuthenticationBase.php

View workflow job for this annotation

GitHub Actions / PHP 8.1 Static Analysis

If condition is always true.

Check failure on line 274 in src/Authentication/AuthenticationBase.php

View workflow job for this annotation

GitHub Actions / PHP 7.4 Static Analysis

If condition is always true.
$cookieConfig = config('Cookie');
$appConfig->cookieDomain = $cookieConfig->domain;
$appConfig->cookiePath = $cookieConfig->path;
$appConfig->cookiePrefix = $cookieConfig->prefix;
$appConfig->cookieSecure = $cookieConfig->secure;
$appConfig->cookieHTTPOnly = $cookieConfig->httponly;
}

// Create the cookie
set_cookie(
'remember', // Cookie Name
Expand Down
Loading