Problem/Motivation

When I upgrade the module from previous versions to the latest one, I'm getting this error:

 [notice] Update started: sitemap_update_8101
 [error]  Drupal\Core\Entity\EntityStorageBase::loadMultiple(): Argument #1 ($ids) must be of type ?array, string given, called in /app/source/web/modules/contrib/sitemap/sitemap.install on line 14
 [error]  Update failed: sitemap_update_8101
 [error]  Update aborted by: sitemap_update_8101
 [error]  Finished performing updates.

This happens because \Drupal\user\RoleStorage::loadMultiple(?array $ids = NULL): array (inherited from \Drupal\Core\Entity\EntityStorageBase::loadMultiple(?array $ids = NULL): array), but the update hook passes a string instead.

Steps to reproduce

Install and configure 'drupal/sitemap:^2.0@RC', then upgrade to the latest version 'drupal/sitemap:^2.0'. Running drush updb, you will get the error.

Proposed resolution

Fix the call to loadMultiple():

- loadMultiple('administer site configuration');
+ loadMultiple(['administer site configuration']);

Remaining tasks

  1. Write a merge request - done by @programeta in #2
  2. Review and feedback - done by @dhruv.mittal in #5
  3. RTBC and feedback - done by @mparker17 in #6
  4. Commit - done by @mparker17 in #11
  5. Release - released in version 8.x-2.1

User interface changes

None.

API changes

None.

Data model changes

None.

Issue fork sitemap-3537538

Command icon Show commands

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

programeta created an issue. See original summary.

programeta’s picture

Assigned: programeta » Unassigned
Status: Active » Needs review
dhruv.mittal’s picture

Reviewing this

dhruv.mittal’s picture

Status: Needs review » Reviewed & tested by the community

Changes look good to me so moving it to RTBC

mparker17’s picture

This looks good to me! Apologies for the time it took to review this.

mparker17 changed the visibility of the branch 3537538-fix_update_8101 to hidden.

mparker17’s picture

Crediting contributors.

mparker17’s picture

Version: 8.x-2.0 » 8.x-2.x-dev
Priority: Normal » Major
Issue summary: View changes

Updating issue summary and metadata.

mparker17’s picture

I rebased and testbot is happy now, so I'm going to merge this shortly.

mparker17’s picture

Issue summary: View changes
Status: Reviewed & tested by the community » Fixed

Okay! This has been merged! I'm reviewing the issues in the queue with an aim to make a release soon! Thanks again for your patience!

mparker17’s picture

Issue summary: View changes

Quick update: the changes in this issue have been released in version 8.x-2.1.

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.