Hoping I didn't miss another open issue, using the D7 dev branch, I received the following error
Notice: Undefined offset: 4 in theme_nodeaccess_grants_form() (Zeile 836 von /Applications/XAMPP/xamppfiles/htdocs/drupal7.0/modules/nodeaccess/nodeaccess.module).
Notice: Undefined offset: 4 in nodeaccess_grants_form() (Zeile 577 von /Applications/XAMPP/xamppfiles/htdocs/drupal7.0/modules/nodeaccess/nodeaccess.module).
Notice: Undefined offset: 4 in nodeaccess_grants_form() (Zeile 577 von /Applications/XAMPP/xamppfiles/htdocs/drupal7.0/modules/nodeaccess/nodeaccess.module).
Seems to work nonetheless though...
(I was trying to add grants to newly added users.)
Great module! It saved me hours already!
| Comment | File | Size | Author |
|---|---|---|---|
| #4 | undefined_offset_grants_form-1088920-4.patch | 541 bytes | rv0 |
Comments
Comment #1
maxweld commentedI got a similar message. However, after I configured the module, specifically setting some "Allowed Roles" with the modules configuration page, this problem seemed to disappear.
Comment #2
tristanmatthews commentedSo because it defaults to an array() in
$allowed_roles = variable_get('nodeaccess-roles', array());
the line
if (is_array($roles)) {
always returns true, so I just changed line 577 from
if ($allowed_roles[$key]) {
to
if (array_key_exists($key, $allowed_roles)) {
The problem goes away because once you have defined something your now longer loading the default empty array. I'm not really sure if this is the "proper solution" or has all the behavior desired but it made the error message go away for me so I'm going with it.
-Tristan
Comment #3
pdeclarens commentedJust for information !
I have the following:
Notice : Undefined offset: 1 dans nodeaccess_grants_form() (ligne 577 dans /homepages/42/d141549472/htdocs/mbc/drupal-7.4/sites/all/modules/nodeaccess/nodeaccess.module).
Notice : Undefined offset: 3 dans nodeaccess_grants_form() (ligne 577 dans /homepages/42/d141549472/htdocs/mbc/drupal-7.4/sites/all/modules/nodeaccess/nodeaccess.module).
Notice : Undefined offset: 2 dans nodeaccess_grants_form() (ligne 577 dans /homepages/42/d141549472/htdocs/mbc/drupal-7.4/sites/all/modules/nodeaccess/nodeaccess.module).
Comment #4
rv0 commentedsame as patch (with isset instead of array_key_exists as it is faster and more common used in drupal)
Comment #5
vlad.pavlovic commentedThank you, will push the patch later today to dev version.
Comment #6
vlad.pavlovic commentedFix pushed to dev.