-
Notifications
You must be signed in to change notification settings - Fork 1.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Bug: New Service replacement fails at service provider precedence on core factory implementations #4483
Comments
@MGatner is the right way to get a service always to call |
Right idea but it is actually The helper function |
So then i replace all |
I think it should be |
Yeah 🤦♂️🤦♂️🤦♂️ |
When a core service factory implementation calls another service (which should be overwritten by an app or module service), the service provider precedence doesn't work.
When
CodeIgniter\Config\Services::exceptions()
is called it internally callsstatic::response()
.As of #3943 this should again check for
response
service factories in all service providers. Instead, the core factorystatic::response
is used.Tl;dr: Right now we can't replace services when they are called in core factories.
Workaround: Let
Config\Services
extendCodeIgniter\Config\Services
, as done before.CodeIgniter 4 version
development
Affected module(s)
Services
Expected behavior, and steps to reproduce if appropriate
All service providers should never call
static::foobar()
as this ignores the service provider precedence.Instead, there should be a simple way to fetch the right service provider / service.
Reproduce
exceptions
service).When creating a new instance from the config service provider we get the right service.
The text was updated successfully, but these errors were encountered: