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
- Install Drupal 10.3 with the Filter module enabled and at least one configured text format.
- Install
m40324042.0.2. - Ensure at least one role has the
administer site configurationpermission. - Upgrade Drupal core to Drupal 11 and
m4032404to 2.0.3 as part of the same deployment. - Run database updates before performing a separate full cache rebuild.
- 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
| Comment | File | Size | Author |
|---|---|---|---|
| #2 | m4032404_3617515_2.patch | 696 bytes | yovince |
Issue fork m4032404-3617515
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
Comment #2
yovinceComment #5
yovinceOh God, I accidentally clicked "Hide Branch." What happened?
Comment #8
elc commentedAll 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?
Comment #10
elc commented