skip to Main Content

A PHP Error was encountered

Severity: 8192

Message: Creation of dynamic property CI_URI::$config is deprecated

Filename: core/URI.php

Line Number: 102

Backtrace:

File: C:xampphtdocsinv_perpusindex.php
Line: 288
Function: require_once

4

Answers


  1. This is an issue with CodeIgniter.

    in /system/core/URI.php you can add this to the top of the class to fix it:

    /**
     * CI Config
     *
     * @var CI_Config
     */
    public $config;
    

    Or, you can disable deprecation warnings in one of two ways:

    php.ini

    error_reporting = E_ALL & ~E_DEPRECATED
    

    in code:

    ini_set('error_reporting', E_ALL & ~E_DEPRECATED);
    

    of course it is bad practice to disable these errors, as these errors should be heard loudly and fixed quickly.

    I opened an issue with CodeIgniter and opened a pull-request to resolve this for you in their next release. They should be onto it relatively quickly and release a patch soon thereafter so just let the course of it play out and silence the error for now

    This issue is resolved in CodeIgniter 4 however

    Login or Signup to reply.
  2. Also not a best practice, but instead of set the error reporting, in my case it was better solution to simply added an @ charachter to the beginning of each reported lines.

    Login or Signup to reply.
  3. I think a better way is to implement #[AllowDynamicProperties]

    Easier and much shorter.

    In all the above mentioned classes add #[AllowDynamicProperties] above class xxxxxx {

    I give you my changes:

    /system/core/URI.php

    #[AllowDynamicProperties]
    
    class CI_URI {
    

    /system/core/Router.php

    #[AllowDynamicProperties]
    
    class CI_Router {
    

    /system/core/Loader.php

    #[AllowDynamicProperties]
    
    class CI_Loader {
    

    /system/core/Controller.php

    #[AllowDynamicProperties]
    
    class CI_Controller {   
    

    /system/database/DB_driver.php

    #[AllowDynamicProperties]
    
    abstract class CI_DB_driver {
    
    Login or Signup to reply.
  4. change this

    error_reporting(-1);

    ini_set(‘display_errors’, 1);

    to

    error_reporting(0);

    ini_set(‘display_errors’, 0);

    in index.php in codeigniter

    welcome……

    1. List item
    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search