WYSIWYG install error after core 10.4.2 upgrade

Created on 10 February 2025, about 2 months ago

Problem/Motivation

After upgrading to Drupal core 10.4.2, there are errors in the panopoly_wysiwyg install hook, and permissions are not granted as expected.

Steps to reproduce

Create a local site using the composer recommended project for Panopoly 3.0.x. This should install Drupal core 10.4.2.
Install Panopoly in its default state via drush: drush -y si panopoly
Note the following errors:

 [error]  Non-existent permission(s) assigned to role "Anonymous user" (anonymous) were removed. Invalid permission(s): use text format restricted_html.
 [error]  Non-existent permission(s) assigned to role "Authenticated user" (authenticated) were removed. Invalid permission(s): use text format restricted_html.
 [error]  Non-existent permission(s) assigned to role "Editor" (editor) were removed. Invalid permission(s): use text format restricted_html.

These log messages were added in core 10.4.2 to replace an uncaught exception that happened when there were ghost permissions from modules that had been installed and then uninstalled - see πŸ’¬ RuntimeException: Adding non-existent permissions to a role is not allowed Active . I don't think Panopoly ever experienced this exception in its install process, but the log messages are now showing up. It looks like the format is no longer available at the time in the install process where panopoly_wysiwyg_install runs. Something changed in the install order.

Proposed resolution

Move the permission grants from hook_install to hook_modules_installed.

Remaining tasks

Patch and test.

User interface changes

None.

API changes

None.

Data model changes

None.

πŸ› Bug report
Status

Active

Version

3.0

Component

WYSIWYG

Created by

πŸ‡ΊπŸ‡ΈUnited States cboyden

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

  • Issue created by @cboyden
  • πŸ‡ΊπŸ‡ΈUnited States cboyden

    Patch is attached.

  • πŸ‡ΊπŸ‡ΈUnited States dsnopek USA

    Thanks! Merged :-)

    • dsnopek β†’ committed f62e24eb on 3.0.x
      Issue #3505612 by cboyden: WYSIWYG install error after core 10.4.2...
  • Automatically closed - issue fixed for 2 weeks with no activity.

  • πŸ‡ΊπŸ‡ΈUnited States cboyden

    I think this needs reopening, the patch is not fixing the issue.

    /**
     * Implements hook_modules_installed().
     */
    function panopoly_wysiwyg_modules_installed(array $modules) {
    
      user_role_grant_permissions('anonymous', [
        'use text format restricted_html',
      ]);
      user_role_grant_permissions('authenticated', [
        'use text format restricted_html',
        'use text format panopoly_wysiwyg_basic',
      ]);
      user_role_grant_permissions('editor', [
        'use text format restricted_html',
        'use text format panopoly_wysiwyg_basic',
      ]);
    
    }
    

    Unfortunately this is not how hook_modules_installed works. The hook for panopoly_wysiwyg doesn't run when panopoly_wysiwyg is installed, it runs when any module is installed after panopoly_wysiwyg.

    Instead the hook should probably be moved to panopoly.install and specifically look for panopoly_wysiwyg. If anyone's using the module without the install profile, they can grant the permissions in some other way. New patch forthcoming.

  • πŸ‡ΊπŸ‡ΈUnited States cboyden

    New patch is attached.

Production build 0.71.5 2024