So I have decided to clean up a bunch of these error messages that I'm getting. They all see to be the results of code of the for

if ($array_name[$key_name]) .....

Where there array defaults to the an empty array so that you get an error message like

"Notice: Undefined index: business_page in nodeaccess_access() (line 91 of /home/cleanhip/public_html/fogeater.com/stanfordinn.com/drupal/sites/all/modules/nodeaccess/nodeaccess.module)."

When I tried going to the page with an anonymous user. The fix I have been using for these bugs, which I'm not sure is the best fix, is to replace

$array_name[$key_name]
With
array_key_exists($key_name, $array_name)

-Tristan

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

Seph’s picture

I am getting a similar error message that shows up on all of my pages.

Notice: Undefined index: page in nodeaccess_access() (line 91 of /home.../sites/all/modules/nodeaccess/nodeaccess.module).

Notice: Undefined index: webform in nodeaccess_access() (line 91 of /home.../sites/all/modules/nodeaccess/nodeaccess.module).

What do I need to do to clear it up?

The code from line 91 down is:

if ($node->nid && $allowed_types[$node->type] &&
(user_access('grant node permissions', $account) ||
(user_access('grant editable node permissions', $account) && node_access('update', $node, $account)) ||
(user_access('grant deletable node permissions', $account) && node_access('delete', $node, $account)) ||
(user_access('grant own node permissions', $account) && ($account->uid == $node->uid)))) {
return TRUE;
}
}

return FALSE;
}

Darkplek’s picture

Just changing line 91 to read

if ($node->nid && array_key_exists($node->type, $allowed_types) &&

fixed the problem for me.

Hope that helps :)

windsurfitaly’s picture

Status: Active » Fixed

yes it works goo thanks a lot man

Status: Fixed » Closed (fixed)

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

weri’s picture

Status: Closed (fixed) » Needs review
FileSize
1.1 KB

Please add this modification to the nodeaccess code.

drupal_jon’s picture

Here's a patch against the last dev release (2011-Feb-17).

holtzermann17’s picture

Thanks, used the quick fix from #2 to get past an error.

vlad.pavlovic’s picture

Changed to use isset instead. Patch attached, will push to dev when I complete some other additions as well.

Thanks all.

vlad.pavlovic’s picture

Status: Needs review » Fixed

Fix pushed to dev.

Status: Fixed » Closed (fixed)

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