Closed (fixed)
Project:
Drupal core
Version:
9.4.x-dev
Component:
configuration system
Priority:
Normal
Category:
Bug report
Assigned:
Unassigned
Issue tags:
Reporter:
Created:
6 Jun 2022 at 11:38 UTC
Updated:
20 Jun 2022 at 15:29 UTC
Jump to comment: Most recent, Most recent file
Comments
Comment #2
alexpottTagged with Distribution Modernization Initiative because this blocks #2392815: Module uninstall validators are not used to validate a config import which in turn blocks #1170362: Install profile is disabled for lots of different reasons and core doesn't allow for that.
Comment #3
alexpottComment #4
alexpottIf you look at the two tests changed here you can see the errors have items from the previous call to ::validate() which is incorrect. Each call to validate() should create a completely new list. We can't see errors to an empty array in
\Drupal\Core\Config\ConfigImporter::reset()because otherwise we can't get the errors at the end of a configuration import because we call ::reset() in\Drupal\Core\Config\ConfigImporter::finish().Comment #5
bircherThe test bot is not done running.. but..
don't we have to set back
$sync->write('core.extension', $extensions);otherwise the second validation still contains the error about the missing module.Comment #6
alexpott@bircher that's part of the bug - the test in HEAD has things duplicated in it :)
Also I think we should take this opportunity to refactor \Drupal\KernelTests\Core\Config\ConfigImporterTest to use \Drupal\Tests\ConfigTestTrait properly - there's no need to this test to do it's own stuff.
Comment #7
bircherOk, checking out the code and applying the patch reveals that we currently assert that the error messages are duplicated!
Lol... we even assert that the bug exists! I was going to write we should set it back so that we can see the error message go away the second time.. but of course just fixing the duplication is good enough.
cross-post
Yes I saw that better with the patch applied and the IDE than just by looking at the patch alone
Comment #8
alexpottLet's be consistent and always define the variable outside of the try...
Comment #9
bircherLooks good to me.
I just tested this to see if it could also fix a bug in my contrib project (#3255091: Deactivating via the UI can fail in some circumstances) but alas, my bug is in another castle.
One could nitpick to add a comment before resetting the errors in validate.. but actually this makes so much sense that it is rather fascinating how the original code was ok with it being duplicated in the first place. So I am good with RTBC.
Comment #11
catchResetting errors makes total sense. A bit odd that the tests were verifying the bug exists but can also see how it happened given the bug is more errors than there is supposed to be rather than some vs. zero.
Committed/pushed to 10.0.x, cherry-picked to 9.5.x and 9.4.x, thanks!
Comment #12
immaculatexavier commentedComment #13
immaculatexavier commented