In this article, we will give you solution for codeigniter 3 deprected dynamic properties int php 8.2. Fix CodeIgniter 3 deprecated dynamic property warnings in PHP 8.2 with our step-by-step guide. Learn how to update your files for full PHP 8.2 compatibility.

there is error coming when you are facing deprecated dynamic property error after upgrading from PHP version 7.4 to 8.2 in CodeIgniter 3? Fix compatibility issues with our complete guide and solutions. This error occurring in the higher version of PHP 8.2.

Message: Creation of dynamic property CI_URI::$config is deprecated
Filename: core/URI.php

Add the public variables to the files./system/core/URI.php

class CI_URI {

    public $config;
}

Message: Creation of dynamic property MY_Router::$uri is deprecated
Filename: core/Router.php

Add the public variables to the files./system/core/Router.php

class CI_Router {

    public $uri;
}


Message: Creation of dynamic property CI::$exceptions is deprecated
Filename: core/Controller.php

Message: Creation of dynamic property CI::$router is deprecated
Filename: core/Controller.php

Message: Creation of dynamic property CI::$output is deprecated
Filename: core/Controller.php

Message: Creation of dynamic property CI::$security is deprecated
Filename: core/Controller.php

Message: Creation of dynamic property CI::$input is deprecated
Filename: core/Controller.php

Message: Creation of dynamic property CI::$lang is deprecated
Filename: core/Controller.php

Message: Creation of dynamic property CI::$form_validation is deprecated
Filename: core/Loader.php

Add the public variables to the files./system/core/Loader.php

class CI_Loader {
   
    public $load;
    public $benchmark;
    public $config;
    public $log;
    public $hooks;
    public $utf8;
    public $uri;
    public $router;
    public $exceptions;
    public $output;
    public $security;
    public $input;
    public $lang; 
}

Add the public variables to the files./system/core/Controller.php

class CI_Router {

    public $benchmark;   
    public $config;
    public $log;   
    public $hooks; 
    public $utf8;   
    public $uri;
    public $router;   
    public $exceptions;   
    public $output;   
    public $security;
    public $input;   
    public $lang; 
    public $db;     
    public $email;
    public $form_validation;

}

If you do not understand the above solution, you can try another solution, but it is a temporary solution. open the index.php file into root directory. change development to production mode

define('ENVIRONMENT', isset($_SERVER['CI_ENV']) ? $_SERVER['CI_ENV'] : 'production');