Drupal + pgsql user.module SQL error with external auth (openid,jabber)
Got errors then logging to site first time.
* warning: array_keys() [function.array-keys]: The first argument
should be an array in
/opt/www/drupal/modules/user/user.module on line 368.
* warning: implode() [function.implode]: Bad arguments. in
/opt/www/drupal/modules/user/user.module on line 368.
* warning: pg_query() [function.pg-query]: Query failed: ERROR: syntax
error at or near ")" LINE 1: ...r INNER JOIN permission p ON p.rid = r.rid
WHERE r.rid IN () ^ in
/opt/www/drupal/includes/database.pgsql.inc on line 125.
* user warning: query: SELECT DISTINCT(p.perm) FROM role r INNER JOIN
permission p ON p.rid = r.rid WHERE r.rid IN () in
/opt/www/drupal/includes/database.pgsql.inc on line 144.
Simple patch:
--- user.module Thu Jul 26 23:16:50 2007
+++ user.module Sun Oct 7 09:41:22 2007
@@ -364,7 +364,7 @@
// To reduce the number of SQL queries, we cache the user's permissions
// in a static variable.
- if (!isset($perm[$account->uid])) {
+ if ((!isset($perm[$account->uid]))&&(is_array($account->roles))) {
$result = db_query("SELECT DISTINCT(p.perm) FROM {role} r INNER JOIN {permission} p ON
p.rid = r.rid WHERE r.rid IN (%s)", implode(',', array_keys($account->roles)));
$perm[$account->uid] = '';
| Comment | File | Size | Author |
|---|---|---|---|
| #2 | user.module.sqlerror.patch | 598 bytes | yagel |
Comments
Comment #1
drummPlease attach a patch file, as described at http://drupal.org/patch/create
Comment #2
yagel commentedAttached patch works fine for me, please see it.
Comment #3
yagel commentedMore details:
This bug appears when user with external auth module logging in first time (and his account auto-creating).
Comment #4
yagel commentedpresent in latest release,
can be patched by
user.module.sqlerror.patch 598 bytes
Comment #5
cridenour commentedI confirm this works. As someone who is writing a external auth module, I am finding it impossible without doing a hack like recreating user_authenticate as ldap_integration does.
Please commit!
Comment #6
damien tournoud commentedThis was a duplicate of #165642: error in SQL syntax in user.module on line 368 (or 378), that was fixed in 5.8. Please open a new ticket if you are still having issues.