The KeyConfigOverrides class, which is the controller for the key.config_override service, currently uses static method calls to the global Drupal object. Instead, those services should be passed in as arguments.
| Comment | File | Size | Author |
|---|---|---|---|
| #18 | interdiff.txt | 1.77 KB | rlhawk |
| #18 | 2939854-18.patch | 2.72 KB | rlhawk |
| #16 | key-override-recursion-2939854-16.patch | 3.28 KB | douggreen |
| #12 | 2939854-11.patch | 3.68 KB | rlhawk |
| #2 | 2939854-1.patch | 3.33 KB | rlhawk |
Comments
Comment #2
rlhawkHere's a patch that implements this. Two notes:
Comment #4
rlhawkComment #5
rlhawkThe failing tests seem to be the result of a Drupal core bug in 8.6.
Comment #6
tynor commentedLooks good to me.
Comment #8
rlhawkComment #9
gaydamaka commentedAfter merging this patch I have the error after a site-install:
Symfony\Component\DependencyInjection\Exception\ServiceCircularReferenceException: Circular reference detected for service "language_manager", path: "language_request_subscriber -> language_manager -> config.factory -> key.config_override -> key.repository -> entity_type.manager -> string_translation -> string_translator.locale.lookup". in Drupal\Component\DependencyInjection\Container->get() (line 141 of /home/d07d/www/core/lib/Drupal/Component/DependencyInjection/Container.php).Modules
languageandlocaleare enabled. I have the same error afterLocalemodule installing. I’ve found the issue which fixes this one https://www.drupal.org/project/key/issues/2924257 but after merging this patch doesn’t work.Comment #10
manuel garcia commentedOn #2924257: Circular reference prevents module installation it was found that switching to static loading of the Entity Type Manager, instead of using dependency injection, fixed the circular reference issue. However here we are re-introducing dependency injection, although for different things. I don't know enough about the previous bug, but this is probably why the issue is reappearing?
Comment #11
mattltI'm getting the following error when running `drush cr` when updating to this commit, more circular references…
Comment #12
rlhawkI guess we'll need to stick with static calls until the circular dependency issue can be sorted out. Here's a patch that reverts #2924257: Circular reference prevents module installation and adds an update hook to clear the cache.
Comment #13
rlhawkI meant that the patch reverts commit b7dbb4b from this issue.
Comment #14
douggreen commentedI have another patch coming, please wait to commit this.
Comment #15
douggreen commentedSee also #2936885: Calling EntityTypeManager::getDefinition during ConfigFactoryOverrideInterface::loadOverrides can lead to corrupt entity type handlers
Comment #16
douggreen commentedNew patch attached, reverts some of the recursion and dependency injection.
Comment #17
douggreen commentedSome more context...
Key module implemented key config overrides in the 1.6 release. We don't use them.
Config overrides introduced new code that runs early in the loading process, that sometimes causes recursion. Whenever the config is loaded, it triggers the key module override, which tries to load several services and potentially load a key, to see if it overrides the config item being loaded.
The primary culprit that we've noticed is the entity type manager and locale. This patch solves the problem by catching an exception and returning with no overrides. The consequence is, that anything that throws an exception like this, loads too early for key module to override.
The first locale aware configuration item that is loaded will probably trigger the recursion. In our case it was syslog.settings.
Comment #18
rlhawkWe can't remove the $inOverride check. It's critical to the override functionality. I'd also like to keep the static call fallbacks, just to ease updating.
Comment #19
douggreen commentedI think/suspect that the exception does the same thing as both those checks, but I'm fine with the extra code.
Comment #20
rlhawkThe exception catch doesn't duplicate the $inOverride check. They address different issues.
I'll commit this and prepare a new release.
Comment #22
rlhawkComment #23
douggreen commentedYes, you were right, we needed that as well.