![]() |
To create a multilanguages web site I've added into the initController method in BaseController file the following code that causes a warning in log :
Severity Message info Session: Class initialized using 'CodeIgniter\Session\Handlers\FileHandler' driver. warning [DEPRECATED] Creation of dynamic property App\Controllers\Home::$session is deprecated in APPPATH\Controllers\BaseController.php on line 68 What's wrong and how to fix it? Thanks Code: if (session_status() == PHP_SESSION_NONE) {
Add this line to your BaseController.php:
PHP Code: protected $session; https://php.watch/versions/8.2/dynamic-p...deprecated
This works for me in the BaseController.
PHP Code: use Config\Services; What did you Try? What did you Get? What did you Expect?
Joined CodeIgniter Community 2009. ( Skype: insitfx )
(12-26-2024, 12:09 AM)InsiteFX Wrote: This works for me in the BaseController. But you still explicitly declare $session as a property?
Yes, but I don't use it, I just make sure it's loaded.
I use the session help like so: PHP Code: session()->set($data); What did you Try? What did you Get? What did you Expect?
Joined CodeIgniter Community 2009. ( Skype: insitfx )
|
Welcome Guest, Not a member yet? Register Sign In |