Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
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).
Comment | File | Size | Author |
---|---|---|---|
#3 | userprotect-fix_undefined_offset-1411738-1.patch | 538 bytes | h3rj4n |
Comments
Comment #1
jnettikSo 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.
Comment #2
jimboh CreditAttribution: jimboh commentedI 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).
Comment #3
h3rj4n CreditAttribution: h3rj4n commentedA small and dirty fix for this issue. Solved it in my case.
It changes the following:
into
Comment #4
h3rj4n CreditAttribution: h3rj4n commentedForgot to set it to 'needs review'.
Comment #6
MegaChriz CreditAttribution: MegaChriz commentedNot a dirty fix at all. Thanks, committed.