The first argument should be an array in user.module on line 502

Submitted by Jochus on Tue, 16/02/2010 - 22:30 | Posted in: Website

When a user was trying to register, he was getting the following error:

warning: array_keys() [function.array-keys]: The first argument should be an array in user.module on line 502.
user warning: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ')' at line 1 query: SELECT p.perm FROM msn_role r INNER JOIN msn_permission p ON p.rid = r.rid WHERE r.rid IN () in user.module on line 502.

In the end, the user was registered. But it was very confusing :-).

It seems to be a bug in Drupal 6.1x. I found the solution here:
Go to: $SITE_HOME/modules/user/user.module and change line 502:

if (!isset($perm[$account->uid])) {

... into ...

if (!isset($perm[$account->uid]) && isset($account->roles)) {

You were receiving that error because $account->roles is empty and you cannot perform a SQL query with IN ()

Add new comment

The content of this field is kept private and will not be shown publicly.


  • Lines and paragraphs break automatically.
  • You can caption images (data-caption="Text"), but also videos, blockquotes, and so on.
  • Web page addresses and email addresses turn into links automatically.
  • You can enable syntax highlighting of source code with the following tags: <code>, <blockcode>, <bash>, <cpp>, <css>, <html5>, <java>, <javascript>, <php>, <sql>, <xml>. The supported tag styles are: <foo>, [foo].
This question is for testing whether or not you are a human visitor and to prevent automated spam submissions.