- Issue created by @joseph.olstad
- 🇨🇦Canada joseph.olstad
> [error] Drupal\Core\Config\Config::setData(): Argument #1 ($data) must be of type array, Drupal\Core\Config\Config given, called in /var/www/clients/client1/web8/web/docroot/html/profiles/wxt/modules/custom/wxt_core/wxt_core.install on line 695
> [error] Update failed: wxt_core_update_8502 - 🇨🇦Canada joseph.olstad
missing this:
╰❯ $ git diff 5.1.x modules/custom/wxt_core/wxt_core.install diff --git a/modules/custom/wxt_core/wxt_core.install b/modules/custom/wxt_core/wxt_core.install index 5d15742..49606ad 100644 --- a/modules/custom/wxt_core/wxt_core.install +++ b/modules/custom/wxt_core/wxt_core.install @@ -675,7 +675,19 @@ function wxt_core_update_8500() { * Setup CountryManager lists #3111375: Webform should only list approved GoC recognized countries → . */ function wxt_core_update_8501() { - // #3399929: Change wxt_core countries config name → wxt_core_update_8502 in favour + $config_namespace = 'wxt_core.settings.countries'; + $module_handler = \Drupal::service('module_handler'); + $module_path = $module_handler->getModule('wxt_core')->getPath(); + $path = DRUPAL_ROOT . '/' . $module_path . '/config/install/' . $config_namespace . '.yml'; + $country_data = Yaml::parse(\file_get_contents($path)); + + // Get the configuration factory service. + $config_factory = \Drupal::configFactory(); + + // Save the configuration using the loaded data. + $config = $config_factory->getEditable($config_namespace); + $config->setData($country_data); + $config->save(); } /** @@ -692,6 +704,11 @@ function wxt_core_update_8502() { if ($hasUpdated) { $country_data = $config_factory->getEditable($legacy); $config = $config_factory->getEditable($updated); + if (!is_array($country_data)) { + // Update hook 8501 wasn't run correctly for some reason, or the yml was deleted. + wxt_core_update_8501(); + return; + } $config->setData($country_data); $config->save(); // Delete old data.
possibly missing something else, just focused on this install file for now.
- Status changed to Fixed
12 months ago 4:38pm 22 December 2023 - 🇨🇦Canada smulvih2 Canada 🍁
Tried an upgrade from 5.0.1 to 5.1.0 and ran into this issue with drush updb:
[notice] Update started: wxt_core_update_8502 > [error] Drupal\Core\Config\Config::setData(): Argument #1 ($data) must be of type array, Drupal\Core\Config\Config given, called in /var/www/public_html/profiles/wxt/modules/custom/wxt_core/wxt_core.install on line 695 > [error] Update failed: wxt_core_update_8502 [error] Update aborted by: wxt_core_update_8502
Realized this fix was pushed to 5.1.x-dev branch (not 5.1.0 tag), and upgrading to this branch allowed me to complete the upgrade successfully. We should cut a new release 5.1.1 with this change to prevent upgrade issues for other projects.
- 🇨🇦Canada joseph.olstad
@sylus,
Thanks again for committing this, I think with the relative calm of issues being reported, I haven't found any others, I think we could tag 5.1.1 anytime. - 🇨🇦Canada joseph.olstad
A duplicate issue was opened by Open Plus not realizing that this is the solution.
Automatically closed - issue fixed for 2 weeks with no activity.