Problem/Motivation

The m4032404_update_10002() update hook grants the new
administer 403 to 404 settings permission to roles that already
have the administer site configuration permission.

Saving a role causes Drupal to calculate its configuration dependencies. This
loads all available permissions, including permissions provided by
FilterPermissions. Those permission definitions generate URLs for
text formats.

During a major-version database update, the router cache may not yet reflect
the routes provided by the updated Drupal core. Consequently, saving a role
from m4032404_update_10002() can trigger URL generation against
stale routing data and cause the database update to fail.

This is related to the Drupal core issue
#3260208:
FilterPermissions' use of URLs can cause module installations to fail
.
Until the underlying core issue is resolved and available in all supported
core versions, the module's update hook should avoid triggering the problem.

Steps to reproduce

  1. Install Drupal 10.3 with the Filter module enabled and at least one configured text format.
  2. Install m4032404 2.0.2.
  3. Ensure at least one role has the administer site configuration permission.
  4. Upgrade Drupal core to Drupal 11 and m4032404 to 2.0.3 as part of the same deployment.
  5. Run database updates before performing a separate full cache rebuild.
  6. On affected sites, observe that m4032404_update_10002() fails while saving a role because permission dependency calculation attempts to generate a URL using stale routing data.

Proposed resolution

Explicitly rebuild the router at the beginning of
m4032404_update_10002(), before loading and saving roles:

\Drupal::service('router.builder')->rebuild();

This ensures that permission URL generation uses the current route definitions
when role configuration dependencies are calculated.

Remaining tasks

User interface changes

API changes

Data model changes

CommentFileSizeAuthor
#2 m4032404_3617515_2.patch696 bytesyovince

Issue fork m4032404-3617515

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

yovince created an issue. See original summary.

yovince’s picture

StatusFileSize
new696 bytes

elc made their first commit to this issue’s fork.

yovince changed the visibility of the branch 2.x-3617515-update-fix to hidden.

yovince’s picture

Oh God, I accidentally clicked "Hide Branch." What happened?

elc changed the visibility of the branch 2.x-3617515-update-fix to active.

elc’s picture

Status: Active » Needs review

All good, it's easy enough to show it again. Not sure if only a maintainer can do it, but it's showing again now. It doesn't help that it's a single click without a confirmation.

Tests all look clean, but it's beyond my ken to be able to do an upgrade test between Drupal 10 and 11 automatically using the test harness. Have you tested this is working on a site and confirmed it is working?

  • elc committed 41c41606 on 2.x
    bug: #3617515 Fix update 10002 error when saving roles.
    
    By: yovince
    By...
elc’s picture

Version: 2.0.3 » 2.x-dev
Status: Needs review » Fixed

Now that this issue is closed, review the contribution record.

As a contributor, attribute any organization that helped you, or if you volunteered your own time.

Maintainers, credit people who helped resolve this issue.

Status: Fixed » Closed (fixed)

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