There on row 158 is an assignment, which does not validate input and therefore warnings arise.
Please do substitute the row in question with:
$in_pre_auth_role = is_array($account->roles) ? in_array($id, array_keys($account->roles)): NULL;

Comments

hunmonk’s picture

Status: Patch (to be ported) » Closed (works as designed)

line 172 of user.module -- $account->roles should always be an array. you most likely have another module installed that's doing something nasty with the user object. i recommend locating that module and filing a bug against it.

knievel’s picture

Status: Closed (works as designed) » Active

i got the same problem.

in line 155 there is an assignment of some form element to $account:
$account = $form['_account']['#value'];

if you do some form preprocessing this element could possibly not be set.
so your statement that $account->roles should always be an array is not always true.

i slightly modified the solution i.garnizov mentioned, because in_array() returns false instead of null.
$in_pre_auth_role = is_array($account->roles) ? in_array($id, array_keys($account->roles)): FALSE;

hunmonk’s picture

Status: Active » Closed (works as designed)

if you do some form preprocessing this element could possibly not be set.
so your statement that $account->roles should always be an array is not always true.

then the preprocessing is not being done correctly. the module can't be responsible for other coders not following core standards.