Posted by BrandiB on November 10, 2012 at 11:25pm
I don't see anything obviously wrong with this code. All I can think of is that the $account variable has not been used prior to this statement but I'm not sure how to work around this so it stops yelling at me?
if (!isset($perm[$account->uid])) {
$result = db_query("SELECT p.perm FROM {role} r INNER JOIN {permission} p ON p.rid = r.rid WHERE r.rid IN ('. db_placeholders($account->roles) .')", array_keys($account->roles));
$perms = array();
while ($row = db_fetch_object($result)) {
$perms += array_flip(explode(', ', $row->perm));
}
$perm[$account->uid] = $perms;
}
Comments
There is no problem of if
There is no problem of if user_access is called without passing $account as $account is initialized with global $user if account is not send from caller function so $account->roles will always be an array.
Some part of the code is calling the user_access function and passing a $account object which don't have $account->roles as array. You may check recent log entries or check on which page you get this error and check which modules get called for building the page and identify that module or part of code and fix it.
Hth,
Sadashiv.