Notice: Undefined variable: content_perms in node_menu_permissions_permission() (line 71 of ... node_menu_permissions/node_menu_permissions.module
Fatal error: Unsupported operand types in ... modules/contrib/node_menu_permissions/node_menu_permissions.module on line 71

If you haven't at least one node type with one available menu configured you get an fatal error if you try to enable the module.

  }
  return $perms + $content_perms; // Line 71, $content_perms undefined
}

So we should initialize $content_perms before the foreach loop in case we don't get inside the loop.

 // Generate standard node permissions for all applicable node types.
  $types = node_type_get_types();
  $menus = menu_get_menus();
  $content_perms = array(); // Line 30 added
  foreach (node_permissions_get_configured_types() as $type) {
  $type_menus = variable_get('menu_options_' . $type, array('main-menu' => 'main-menu'));

Sorry for not sending this as a patch. I got into this problem on an already removed test system and writing this with the repository viewer. Just that it is documented and the maintainer is aware and can fix this edge case someday.

CommentFileSizeAuthor
#2 node_menu_permissions-1796478-1.patch562 bytesonxze

Comments

onxze’s picture

Issue summary: View changes

Patch for this issue.

onxze’s picture

StatusFileSize
new562 bytes
jyraya’s picture

We're facing the same problem. We applied the patch and it works. So could you tell me if the patch will be integrated in a future version or not?