Download & Extend

Error on new user account submission

Project:Role Weights
Version:5.x-1.x-dev
Component:Code
Category:bug report
Priority:normal
Assigned:Unassigned
Status:closed (fixed)

Issue Summary

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?

Comments

#1

Status:active» needs review

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

<?php
  $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.

AttachmentSize
role_weights_529216-1.patch 719 bytes

#2

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

#3

Version:5.x-1.5» 5.x-1.x-dev

#4

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.

#5

Status:fixed» closed (fixed)

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

nobody click here