user_role_grant_permissions shouldn't merge if module is empty

Created on 24 April 2015, over 9 years ago
Updated 14 March 2023, over 1 year ago

Problem/Motivation

Whenever a user call user_role_grant_permissions if the permission is not valid (not being implemented by any module) Drupal shouldn't try to execute the db_merge since it will incur in a database error.

Proposed resolution

The function already load all permissions by using $modules = user_permission_get_modules();
We should check if $modules[$name] is valid before trying to execute db_merge.

Remaining tasks

Patch provided, needs review.

User interface changes

None

API changes

None

πŸ› Bug report
Status

Closed: outdated

Version

7.0 ⚰️

Component
User moduleΒ  β†’

Last updated 1 day ago

Created by

πŸ‡§πŸ‡·Brazil handrus

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

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

  • πŸ‡¬πŸ‡§United Kingdom alexpott πŸ‡ͺπŸ‡ΊπŸŒ

    FWIW Drupal 10 will throw an exception when a permission does not exist and you save a role. I don't think this change could be made in Drupal 7 because it could break things.

Production build 0.71.5 2024