So I just tried to edit some of my user's accounts and am getting these two errors. It seems to vary on role. Some roles get both errors, others only get one or the other. The admin role doesn't get either.

Notice: Undefined offset: 5 in userprotect_get_user_protection() (line 843 of /home/afcishow/public_html/sites/all/modules/contrib/userprotect/userprotect.module).
Notice: Undefined offset: 6 in userprotect_get_user_protection() (line 843 of /home/afcishow/public_html/sites/all/modules/contrib/userprotect/userprotect.module).

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

jnettik’s picture

Status: Active » Closed (works as designed)

So I was able to figure this out, I had to uninstall and re-install the module. The roles that were throwing the errors were created after this module was installed. I'm guessing the those roles weren't added to the $role_protections variable when they were created.

Not sure if this is still a bug or not, probably could have just went back and resaved the protections by role page.

jimboh’s picture

Status: Closed (works as designed) » Active

I can confirm this bug and that the work-around of going to the protected roles admin page and re-saving does clear the errors.

I am very grateful to the maintainer for this module but respectfully suggest that if the module throws up errors after a new role is added that this is really a bug and that the module should perhaps hook into new role addition and update its own variables (if this is indeed the problem).

h3rj4n’s picture

Version: 7.x-1.0 » 7.x-1.x-dev
FileSize
538 bytes

A small and dirty fix for this issue. Solved it in my case.

It changes the following:

// lines 843 till 845
if ($role_protections[$rid][$protection]) {
	return TRUE;
}

into

// lines 843 till 845
if (!empty($role_protections[$rid][$protection])) {
	return TRUE;
}
h3rj4n’s picture

Status: Active » Needs review

Forgot to set it to 'needs review'.

  • Commit f34f2ff on 7.x-1.x authored by h3rj4n, committed by MegaChriz:
    Issue #1411738 by h3rj4n: fixed undefined offset in...
MegaChriz’s picture

Issue summary: View changes
Status: Needs review » Fixed

Not a dirty fix at all. Thanks, committed.

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.