Hello, I've been getting the following set of errors whenever I create or update a node. Tac lite was added recently. It seems to be working fine in terms of restricting the nodes designated as private.

I have run update.php and eventhough it said no updates available, i forced it to do the update #2. It said it rebuilt the node access table.

I am running drupal 5.1.

Here's the error:


    * warning: array_keys() [function.array-keys]: The first argument should be an array in /home/ihea/public_html/multicultural_health_education/modules/user/user.module on line 361.
    * warning: implode() [function.implode]: Bad arguments. in /home/ihea/public_html/multicultural_health_education/modules/user/user.module on line 361.
    * 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 DISTINCT(p.perm) FROM role r INNER JOIN permission p ON p.rid = r.rid WHERE r.rid IN () in /home/ihea/public_html/multicultural_health_education/includes/database.mysql.inc on line 172.
    * warning: Invalid argument supplied for foreach() in /home/ihea/public_html/multicultural_health_education/sites/all/modules/tac_lite/tac_lite.module on line 317.
    * warning: Invalid argument supplied for foreach() in /home/ihea/public_html/multicultural_health_education/sites/all/modules/tac_lite/tac_lite.module on line 317.

CommentFileSizeAuthor
#4 tac_lite.module.patch372 bytesastreib
#5 tac_lite.module.patch439 bytesastreib

Comments

Aleet’s picture

subscribe

Dave Cohen’s picture

Status: Active » Postponed (maintainer needs more info)

The warning on tac_lite.module line 317 implies that your user account has no roles. Since each user should have at least one role, this means you have another problem and I don't think it's related to tac_lite.

Disable tac_lite, then see if you have errors. Fix them, then re-enable tac_lite.

Aleet’s picture

thanks for your response.

I disabled tac_lite and still getting error. The best I can tell it is related to this issue in the user system:http://drupal.org/node/114074

astreib’s picture

StatusFileSize
new372 bytes

Had the same error in tac_lite 6.x-1.6. After installing and activating the module, I would see the following errors in my error log:

array_fill(): Number of elements must be positive in /var/www/vhosts/*********.org/includes/database.inc on line 256.
implode(): Bad arguments. in /var/www/vhosts/*********.org/includes/database.inc on line 256.
array_keys(): The first argument should be an array in /var/www/vhosts/*********.org/modules/user/user.module on line 528.
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 role r INNER JOIN permission p ON p.rid = r.rid WHERE r.rid IN () in /var/www/vhosts/*********.org/modules/user/user.module on line 528.

Seeing the error was in the db_placeholders() function, I modified that to test that first argument was an array, or throw an ErrorException. That gave me the following stack trace:

Fatal error: Uncaught exception 'ErrorException' with message 'db_placeholders(): first arg must be an array' in /var/www/vhosts/*********.org/includes/database.inc:253 
Stack trace:
#0 /var/www/vhosts/*********.org/modules/user/user.module(530): db_placeholders('administer tac_...')
#1 /var/www/vhosts/*********.org/sites/all/modules/tac_lite/tac_lite.module(284): user_access('load', Array, Object(stdClass), NULL)
#2 /var/www/vhosts/*********.org/modules/user/user.module(32): tac_lite_user('load', Array, Object(stdClass))
#3 /var/www/vhosts/*********.org/modules/user/user.module(195): user_module_invoke(Array)
#4 /var/www/vhosts/*********.org/modules/user/user.module(1441): user_load('astreib', 'webserver_auth')
#5 /var/www/vhosts/*********.org/sites/all/modules/webserver_auth/webserver_auth.module(56): user_external_login_register()
#6 [internal function]: webserver_auth_init('webserver_auth_...', Array)
#7 /var/www/vhosts/*********.org/includes/module.inc(497): call_user_func_array('init')
#8 /var/www/vhosts/dev. in /var/www/vhosts/*********.org/includes/database.inc on line 253

So from what little I know about drupal internals, it looks like the webserver_auth module was loading the user which was firing the hook_user() functions, including tac_lite_user().

The first thing tac_lite_user() does is call user_access to see if the current user has "adminster tac_lite" permission. However apparently at this point $user is not yet set, thus triggering the errors.

A fix seems to be to pass the $account argument on to the user_access() call. The attached patch does this. Hope this may be helpful.

See my next note. Disregard the patch attached to this comment.

astreib’s picture

StatusFileSize
new439 bytes

Actually my patch does not really fix the problem everywhere. I was still getting the error on the module admin page.

I looked at the tac_lite_user() function a little more and realized it's only doing anything when the $op is 'form' or 'categories'

So I just wrapped that test around the user_access() call and that seems to resolve everything (knock on wood).

Disregard the patch above.

tinker’s picture

Status: Postponed (maintainer needs more info) » Closed (won't fix)

5.x version no longer supported.