Warnings when reverting a feature if the role does not exist

Created on 11 February 2016, about 9 years ago
Updated 26 March 2025, 29 days ago

Problem/Motivation

  • Create a fresh D7 instance
  • Install features and block_access
  • Go to admin/people/permissions/roles and create a user role
  • Go to admin/structure/block/block-access/edit/block and configure permissions using the role you created
  • Go to admin/structure/features/create and featurize the block_access permissions into a module (do not featurize the role itself)
  • Go to admin/people/permissions/roles and delete the role
  • Go to admin/structure/features: this generates an error
  • Notice: Undefined offset: 3 in block_access_features_export_render() (line 730 of /var/www/html/d7/sites/all/modules/block_access/block_access.module).

  • Also try to revert the feature: this generates more errors
  • Notice: Undefined index: myrole in block_access_features_revert() (line 757 of /var/www/html/d7/sites/all/modules/block_access/block_access.module).

The errors also show up on admin/reports/dblog.
The errors also seem to pollute simpletest results when running tests on modules that featurize block_access perms but do not featurize the associated roles themselves.

Proposed resolution

Attached is a patch that seems to make the warnings go away, though there might be other solutions.

🐛 Bug report
Status

Closed: won't fix

Version

1.0

Component

Code

Created by

🇨🇦Canada fengtan Montreal, Canada

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.

  • 🇧🇪Belgium dieterholvoet Brussels

    Drupal 7 is EOL as of 5 January 2025 and so is the Drupal 7 version of this module. Marking as Closed (won't fix). Feel free to re-open if this issue is still present in any supported version of the module.

Production build 0.71.5 2024