Welcome Guest, Not a member yet? Register   Sign In
Codeigniter 4 extend core class process clarification
#9

(This post was last modified: 04-17-2024, 05:29 AM by Semsion.)

Thanks for coming back; the error was because the logger hadn't been set for the session. The error has been resolved now.

It's coming across that the session class / method may not be able to be extended / replaced, at least in any reasonable / simple manner.

The next error is from vendor/codeigniter4/framework/system/Security/Security.php:

TypeError

Cannot assign App\Libraries\Session to property CodeIgniter\Security\Security::$session of type ?CodeIgniter\Session\Session

PHP Code:
SYSTEMPATH/Security/Security.php at line 223

216    
private function isCSRFCookie(): bool
217    
{
218        return $this->config->csrfProtection === self::CSRF_PROTECTION_COOKIE;
219    }
220 
221    
private function configureSession(): void
222    
{
223        $this->session Services::session();
224    }
225 
226    
private function configureCookie(CookieConfig $cookie): void
227    
{
228        $cookiePrefix    $cookie->prefix;
229        $this->cookieName $cookiePrefix $this->rawCookieName;
230        Cookie::setDefaults($cookie); 



UPDATE: Ok, looks like we're finally there! Have extended app/Libraries/Session.php with CodeIgniterSession, but pulling in at the top of this file `use CodeIgniter\Session\Session as CodeIgniterSession`.

This has resolved the previous issue, and we're now able to access this new Session class.
Reply


Messages In This Thread
RE: Codeigniter 4 extend core class process clarification - by Semsion - 04-17-2024, 05:08 AM



Theme © iAndrew 2016 - Forum software by © MyBB