I get the warnings
* warning: array_diff() [function.array-diff]: Argument #1 is not an array in G:\xampp\htdocs\drupal-5.1\modules\roleassign\roleassign.module on line 169.
* warning: array_intersect_key() [function.array-intersect-key]: Argument #2 is not an array in G:\xampp\htdocs\drupal-5.1\modules\roleassign\roleassign.module on line 170.
* warning: array_keys() [function.array-keys]: The first argument should be an array in G:\xampp\htdocs\drupal-5.1\modules\roleassign\roleassign.module on line 187.
when I go to Add User (/admin/user/user/create). When I complete the addition, i get the fatal error
Fatal error: Unsupported operand types in G:\xampp\htdocs\drupal-5.1\modules\roleassign\roleassign.module on line 233
I have corrected this completely by changing line 164 from
$assigned_roles = $user->roles;
to
$assigned_roles[] = $user->roles;
I wonder why this type error didn't show up for you; perhaps it's a PHP 4 v 5 issue. I am running PHP 5.1.6 on Apache 2.2.3; if you wish, I can send the PHP configuration or answer specific questions.
Kim Kirkpatrick
kirk@newmexico.com
Comments
Comment #1
TBarregren CreditAttribution: TBarregren commentedThe error messages are due to the fact that
$user->roles
at line 163 isn't an array for you. But it should be!The object
$user
is returned byuser_load(array('uid' => arg(1)))
at line 163, and as you can see from the definition ofuser_load()
at lines 48–91, particular line 73, in user.module$user->roles
is an array.But obviously
$user->roles
isn't an array for you. I don't think it has something to do with your PHP configuration. Instead, I suspect you have another module installed with a faulty implementation of the'load'
operator ofhook_load()
. As you can see at line 84 in user.module,user_load()
ends with a call to all such implementations.Thus, I suggest you disable the other modules one-by-one until you have located the offending module.
If you post a list of enabled modules I will take a look myself to see if I can locate the presumptive faulty module.
Comment #2
kirk837 CreditAttribution: kirk837 commentedThank you. You are correct, this was not a bug; I have reinstalled Drupal, RoleAssign, and UserProtect (the same configuration as before, reinstalled from the previously downloaded tar.gz's) and it all works.
However, the problem was not due to an interfering hook_load() -- UserProtect, the only other non-default module installed, does not implement its own _load() (and, of course, it all works now).
The problematic setup was fresh and default; the only "unusual" thing about it was that, having installed RoleAssign, I allowed the user with RoleAssign privilege to delete the superadministrator, just to overcome my disbelief that it was possible -- shame on drupal devels! I then reinstalled uid=1 directly via mysql. I think the warnings showed up after that, but before UserProtect (but didn't make the connection at the time). There were no other installations, no other external actions -- everything else done to Drupal was done through ordinary admin functions. I know this doesn't seem a likely explanation, but it's the only out-of-the-ordinary thing I can think of.
Comment #3
TBarregren CreditAttribution: TBarregren commentedI am glad it worked out.
Just for the sake of clarity, RoleAssign has nothing to do with the ability to delete user 1. As you probably know, to delete user 1 (or any user for that matter) you need the
administer users
permission, which is a permission of the User module and not of the RoleAssign module.