Closed (fixed)
Project:
CAPTCHA
Version:
2.0.1
Component:
Code
Priority:
Normal
Category:
Bug report
Assigned:
Unassigned
Reporter:
Created:
19 Jul 2023 at 02:15 UTC
Updated:
2 Aug 2023 at 15:34 UTC
Jump to comment: Most recent
As part of the 2.0.1 update, the following hook is updating core.extension.yml incorrectly:
/**
* Ensure caches are cleared with new module folder locations.
*/
function captcha_update_8906() {
// Remove test modules if they're on the site. They won't rebuild.
$extension = \Drupal::configFactory()->getEditable('core.extension');
$modules = $extension->get('module');
unset($modules['captcha_long_form_id_test']);
unset($modules['captcha_test']);
$extension->set('modules', $modules);
$extension->save();
// Need to flush all caches due to module paths changing.
drupal_flush_all_caches();
}Note the lines:
$modules = $extension->get('module');
$extension->set('modules', $modules);
The second line should be updating "module", not "modules". This is leading to erroneous data getting added to core.extension.yml.
Run captcha_update_8906 on any Drupal website, export config, notice core.extension.yml get a new modules key.
Update the hook to set "module" and not "modules".
Start within a Git clone of the project using the version control instructions.
Or, if you do not have SSH keys set up on git.drupalcode.org:
Comments
Comment #3
thomwilhelm commentedComment #4
keshavv commentedComment #5
anybodyThanks for finding this! Looking at this detail and comparing these two lines, this is indeed wrong.
This means we need another update hook after that one, deleting the newly created "modules".
Comment #6
anybodyHappened in #3367503: Difficult migration from Drupal 9 to 10
Comment #8
anybodyIncorporated the MR from #3375351: Problem after updating to 2.0.1 by @ChrisSnyder!
Comment #9
anybodyComment #10
anybodyComment #11
mkalkbrennerI ran into this issue, too.
Comment #13
anybodyThanks, merged! Going to tag 2.0.2
Comment #14
jaydarnellGood catch. I was really confused when I upgraded to 2.0.1 and saw the duplicate "modules" in the core.extension.yml :)
Comment #15
japerryThanks everyone for grabbing this overnight! I even manually tested the upgrade path (due to the test modules failing).