Skip to content
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

fix: change BaseService::reset() $initAutoloader to true by default #6020

Merged
merged 1 commit into from
May 25, 2022

Conversation

kenjis
Copy link
Member

@kenjis kenjis commented May 23, 2022

Description
BaseService::reset(false) makes the autoloader's namespaces empty.
Such use cases are rare and will prevent lang() from working. See codeigniter4/shield#88 (comment)

  • change BaseService::reset() default parameter value to true
  • change CIUnitTestCase::resetServices() default parameter value to true

Checklist:

  • Securely signed commits
  • [] Component(s) with PHPDoc blocks, only if necessary or adds value
  • [] Unit testing, with >80% coverage
  • User guide updated
  • Conforms to style guide

@kenjis kenjis added the breaking change Pull requests that may break existing functionalities label May 23, 2022
Copy link
Member

@MGatner MGatner left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Changing the parameter default and behavior in a minor release worries me a little bit. I do think this is the desired behavior and is a little bit "hidden". Let's see what others think, but a compromise would be to change the default on CIUnitTestCase but not Services yet.

@kenjis
Copy link
Member Author

kenjis commented May 24, 2022

Basically Services::reset() is also only for testing.
It is not used in normal apps.

Apps definitely need namespaces, so if it is used, it would surely be Services::reset(true).
I know only one example:
https://github.com/SDPM-lab/Codeigniter4-Roadrunner/blob/ef6752648ee90e5228ae9ab04ace41fc50f7b5d0/src/Commands/file/psr-worker.php#L136

So I think this change will not affect existing apps.

Copy link
Member

@MGatner MGatner left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

All good points, I'm with you now.

@kenjis kenjis merged commit 2f450db into codeigniter4:develop May 25, 2022
@kenjis kenjis deleted the fix-BaseServices-reset branch May 25, 2022 05:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
breaking change Pull requests that may break existing functionalities
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants