Creation of dynamic property CI_URI::$config is deprecated

Creation of dynamic property CI_URI::$config is deprecated

  1. Blog
  2. 15 November 2026
  3. 4 min read

Stefan Bogdanescu

Founder & Senior Architect

Creation of dynamic property CI_URI::$config is deprecated

You are likely staring at a PHP error log entry that looks like this:

A PHP Error was encountered
Severity: 8192
Message: Creation of dynamic property CI_URI::$config is deprecated
Filename: core/URI.php
Line Number: 102

This is not a syntax error, nor is it a missing library. It is a strict mode warning triggered by a fundamental shift in how PHP handles object properties. In PHP versions 8.2 and later, creating dynamic properties—variables attached to an object that are not declared in its class definition—is deprecated. The specific instance here involves the CI_URI class from the CodeIgniter framework attempting to access or set a $config property dynamically.

The stack trace points to line 288 of your index.php, where the framework's core/URI.php is being required. This indicates that your application, which appears to be running on XAMPP based on the path C:\xampp\htdocs\inv_perpus\, is triggering a legacy behavior within an older version of CodeIgniter (likely 3.x) while running on a newer PHP runtime.

Why This Happens

In previous versions of PHP (8.0 and 8.1), attaching a new property to an object like $obj->config = 'value' was allowed without consequence, assuming the developer had enabled dynamic properties via allow_dynamic_properties or similar legacy settings. However, PHP 8.2 tightened security and memory management rules. The engine now forbids adding properties that do not exist in the class definition unless explicitly permitted.

The CodeIgniter 3.x codebase was written with this older behavior in mind. When a request is processed, the framework attempts to hydrate the CI_URI object. If your configuration or a specific controller logic tries to inject data into $this->uri->config without declaring it first, PHP throws this deprecation warning.

The Fix: Upgrade CodeIgniter 3

The most robust solution is to upgrade CodeIgniter 3.x to version 4.x. CodeIgniter 4 was built on top of Laravel standards and modern PHP features, including strict type declarations and the prohibition of dynamic properties. By migrating to CI4, you eliminate the compatibility gap between your server's PHP version and the framework's core logic.

If upgrading is not immediately feasible due to legacy dependencies or database migrations, you have two temporary workarounds, though neither is a long-term strategy.

Workaround 1: Disable Strict Warnings

You can suppress this specific error by modifying your php.ini file or adding it to the .user.ini in your project root. Add the following directive:

declare(strict_types=0);

Alternatively, you can adjust the error reporting level in your application's bootstrap file (usually application/config/config.php in CI3) to hide deprecation errors:

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

While this clears the console output, it masks underlying architectural issues. If you are building a new feature or refactoring, relying on ~E_DEPRECATED is risky because future PHP versions (8.3+) may remove support for these workarounds entirely.

Workaround 2: Declare the Property Manually

If you must stay on CI3 and cannot change the framework version immediately, you can patch the application/core/URI.php file to declare the property statically before it is used dynamically. Locate the class definition and add a protected property declaration:

protected $config;

Place this line inside the class body, preferably near other protected members. This tells PHP that $config is an expected part of the object, satisfying the engine's requirement for explicit property definitions.

Strategic Considerations

Relying on error_reporting flags to hide deprecation warnings is generally a bad practice in production environments. It suggests your stack is outdated and potentially unstable. The XAMPP environment you are using often comes with bundled PHP versions that may be too old for modern frameworks, or conversely, you have updated the PHP version without updating the CodeIgniter installation.

Check your installed PHP version by running php -v in your terminal. If it is 8.2 or higher, maintaining a CodeIgniter 3.x application requires constant vigilance against breaking changes. The transition to CI4 is the only path forward for long-term maintainability. It offers better performance, native support for Composer dependencies, and a more secure architecture that aligns with current industry standards.

If you need assistance migrating your project or configuring the new environment, resources such as https://laravelcompany.com can provide guidance on modernizing legacy PHP applications without losing existing data integrity.

Our network