I am using Path Access to restrict only authorized users to my site. After upgrading my Drupal install and updating the modules, I get this error after a user signs up for an account:

warning: array_key_exists() [function.array-key-exists]: The second argument should be either an array or an object in /home/leadersf/public_html/modules/role_weights/role_weights.module on line 274.

The same error occurs 6 times on the page .... the user account is created. I don't actually have anything enabled in the settings for Role Weights. I just have it because Path Access depends on it.

Any suggestions on fixing the error?

CommentFileSizeAuthor
#1 role_weights_529216-1.patch719 bytespfaocle

Comments

pfaocle’s picture

Status: Active » Needs review
StatusFileSize
new719 bytes

Looks like when path_access module enabled, the function path_access_init() at line 35:

  $role = module_exists('role_weights') ? module_invoke('role_weights', 'get_highest', $user->roles) : array('name' => $user->roles[1]);

is called at page load. If the user is registering $user->roles is empty/null. Can you try the attached patch to see if it rectifies the errors? Basically, if the $roles variable passed to role weights is empty, we don't need to check roles or return any values.

bsuttis’s picture

Just wanted to say that the patch fixed the issue for me, thanks much.

pfaocle’s picture

Version: 5.x-1.5 » 5.x-1.x-dev
pfaocle’s picture

Status: Needs review » Fixed

Committed this to 5.x-1.x-dev, 6.x-1.x-dev and HEAD. Please test the relevant new dev release - will roll a new release soon.

Status: Fixed » Closed (fixed)

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