Skip to content

Adding dynamic properties by Registrars will be deprecated on PHP 8.2 #6162

Description

@kenjis

Registrars can add dynamic properties now.

But the sample code in the user guide will cause the error on PHP 8.2.
https://codeigniter4.github.io/CodeIgniter4/general/configuration.html#explicit-registrars

bash-3.2$ php public/index.php 


[ErrorException]

Creation of dynamic property Config\MySalesConfig::$actual is deprecated

at SYSTEMPATH/Config/BaseConfig.php:211

Backtrace:
  1    SYSTEMPATH/Config/BaseConfig.php:211
       CodeIgniter\Debug\Exceptions()->errorHandler(8192, 'Creation of dynamic property Config\\MySalesConfig::$actual is deprecated', '.../CodeIgniter4/system/Config/BaseConfig.php', 211)

  2    SYSTEMPATH/Config/BaseConfig.php:64
       CodeIgniter\Config\BaseConfig()->registerProperties()

  3    APPPATH/Controllers/Home.php:9
       CodeIgniter\Config\BaseConfig()->__construct()

  4    SYSTEMPATH/CodeIgniter.php:896
       App\Controllers\Home()->index()

  5    SYSTEMPATH/CodeIgniter.php:466
       CodeIgniter\CodeIgniter()->runController(Object(App\Controllers\Home))

  6    SYSTEMPATH/CodeIgniter.php:349
       CodeIgniter\CodeIgniter()->handleRequest(null, Object(Config\Cache), false)

  7    FCPATH/index.php:55
       CodeIgniter\CodeIgniter()->run()
bash-3.2$ php -v
PHP 8.2.0-dev (cli) (built: Jun 20 2022 00:32:41) (NTS)
Copyright (c) The PHP Group
Zend Engine v4.2.0-dev, Copyright (c) Zend Technologies
    with Zend OPcache v8.2.0-dev, Copyright (c), by Zend Technologies

References:

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions