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: Factories caching bug #8037

Merged
merged 4 commits into from
Oct 18, 2023
Merged

Conversation

kenjis
Copy link
Member

@kenjis kenjis commented Oct 12, 2023

Description
See #8036 (comment)

  • fix a bug that $options are not saved in cache
  • refactor

Details
This bug is hidden. Because when restoring the cache, Config\App is instantiated and calls:

static::$moduleConfig = config(Modules::class);

The above code calls Factories::getOptions() and it calls setOptions() and sets self::$options['config'].
Therefore after the instantiation, Factories::$options['config'] is always set.

But this change removed config(). So after the instantiation, Factories::$options['config'] will be empty.
When $options['config'] is empty, getOptions() calls setOptions() and it calls reset():

self::reset($values['component']);

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 changed the title fix: Factories caching factories cache bug fix: Factories caching bug Oct 12, 2023
@kenjis kenjis added bug Verified issues on the current code behavior or pull requests that will fix them 4.4 labels Oct 12, 2023
@kenjis kenjis merged commit a9fa8f0 into codeigniter4:develop Oct 18, 2023
61 checks passed
@kenjis kenjis deleted the fix-Factories-cache-bug branch October 18, 2023 01:15
@kenjis kenjis mentioned this pull request Oct 18, 2023
5 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
4.4 bug Verified issues on the current code behavior or pull requests that will fix them
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants