Client installed webserver_auth and got the following errors on new account creation:

* warning: array_fill() [function.array-fill]: Number of elements must be positive in /u1/www/html/includes/database.inc on line 253.
* warning: implode() [function.implode]: Bad arguments. in /u1/www/html/includes/database.inc on line 253.
* warning: array_keys() [function.array-keys]: The first argument should be an array in /u1/www/html/modules/user/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 role r INNER JOIN permission p ON p.rid = r.rid WHERE r.rid IN () in /u1/www/html/modules/user/user.module on line 502.

I was able to reproduce the issue in our staging environment and discovered that upon entry to webserver_auth_init(), the global $user variable had partial information on the last account the user used to log in. Patch below unsets $user before trying to log in so Drupal is forced to load fresh user data.

CommentFileSizeAuthor
#1 webserver_auth_force_user_reload.patch309 bytescsixty4
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

csixty4’s picture

Patch somehow got lost in all the previews & edits

wimvds’s picture

This seemed to work at first, but I ran into some problems afterwards, so I guess it doesn't really fix it. I'm trying to figure it out now.

alexanderrozenson’s picture

Did you managed to solve this issue? I'm using NTLM and refreshing the page helps to sign. It happens once only in the first log-in but still annoying

Magilla’s picture

I'm getting virtually the same thing:

* warning: array_fill(): Number of elements must be positive in C:\Inetpub\wwwroot\drupal\includes\database.inc on line 253.
* warning: implode(): Invalid arguments passed in C:\Inetpub\wwwroot\drupal\includes\database.inc on line 253.
* warning: array_keys() expects parameter 1 to be array, null given in C:\Inetpub\wwwroot\drupal\modules\user\user.module on line 515.
* 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 role r INNER JOIN permission p ON p.rid = r.rid WHERE r.rid IN () in C:\Inetpub\wwwroot\drupal\modules\user\user.module on line 515.

As far as I can tell, it's to do with having the Profile module on together with the Webserver Authentication.

alexanderrozenson’s picture

Disabling profile module doesnt solve the issues and I still see this error messages

teezee’s picture

It might be cleaner to use:

$user =  drupal_anonymous_user();

instead of just unsetting $user:

unset($user);

because there are some modules/functions that check for the value of $user->uid, and that might throw an warning/notice when $user is not even set.

boilermaker.jb1’s picture

I apologize in the delay responding to this issue. I agree this would be a cleaner way to do it. I will look into what drupal_anonymous_user() does and see about publishing a dev release.

Nor4a’s picture

#1 Fixed the problem if the user was already registered in the DRUPALS database, but if user was comming from $_SERVER['REMOTE_USER'] variable, the login successful was for the first time (when account was created), but when the user tries to access the site again - auto init fails.

Fix for users which were registered in the DRUPAL database as usual users, problem fixed with adding a record for each user to the {authmap} table - e.g. for ADMIN user it is like this: INSERT INTO {authmap}(uid,authname,module) VALUES (1,admin,webserver_auth);

Eaglecanada’s picture

I am still getting the error. What's the solution? not quite get Nor4a 's method.
use Version: 6.x-1.0

gaards’s picture

Issue summary: View changes
Status: Needs review » Closed (outdated)

Closed because Drupal 6 is no longer supported. If the issue verifiably applies to later versions, please reopen with details and update the version.