Bug: Usage of static::methodName
in CodeIgniter\Config\Services prevents Service overriding
#2376
Labels
bug
Verified issues on the current code behavior or pull requests that will fix them
The Bug
There are multiple methods in CodeIgniter\Config\Services that make calls to other methods in the class using the form
static::someMethod()
.For instance, see CodeIgniter\Config\Services::renderer() where the last line in the method is
The problem is that any overriding service defined in APPPATH/Config/Services.php is not in scope so the core class is delivered and not the extended one.
The following services are all called using the
static::someMethod()
form and so cannot be extended.And I might have missed some. There are quite a few CodeIgniter\Config\Services that make static calls to those services so the ramifications would conceivably multiply.
CodeIgniter version
CI 4.0.0-rc.3 at commit 2c04e1c (10/28/19)
Affected module
Services
Reproducing the Problem
Extend Logger
In APPPATH/Config/Services.php
In a controller (of your choice)
Produces the following error
Call to undefined method CodeIgniter\Log\Logger::myNewMethod()
Context
The text was updated successfully, but these errors were encountered: