Hi! I just enabled password_policy on an Ubercart 2.13-6.30 site. I didn't get any errors on the enable, but when I tried to force all users to change their password, I got this error:

    Warning: array_fill(): Number of elements must be positive in db_placeholders() (line 276 of [path]/pressflow-6.30.1/includes/database.inc).
    Warning: implode(): Invalid arguments passed in db_placeholders() (line 276 of [path]/pressflow-6.30.1/includes/database.inc).
    User warning: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near ')' at line 1 query: UPDATE password_policy_force_change SET force_change = 1 WHERE uid IN () in _db_query() (line 169 of [path]/pressflow-6.30.1/includes/database.mysqli.inc).

Looking again, I realized that one of the roles, "product_role", is provided by Ubercart, and this site does not actually have any users with that role.

So, I tried to force a password change again, using only those roles that have users. This did not throw an error.

But when I tried to force a password change only for "product_role" users, I got the error again.

So, I wonder if this is a general bug that occurs whenever a password change is forced on a role with no users. If so, it could probably be fixed with a quick check.

Thanks!

Comments

aohrvetpv’s picture

Version: 6.x-1.6 » 6.x-1.x-dev
Status: Active » Needs review
StatusFileSize
new720 bytes

You did all but write the patch, thanks. Fixed problem in the same way as 7.x-1.x had already fixed it (added !empty($uids) check).

deekayen’s picture

Version: 6.x-1.x-dev » 7.x-1.x-dev
Status: Needs review » Patch (to be ported)
aohrvetpv’s picture

Status: Patch (to be ported) » Fixed

Was already fixed in 7.x-1.x. 7.x-2.x does not currently have "force password change" feature, so this issue does not apply to it.

aohrvetpv’s picture

Version: 7.x-1.x-dev » 6.x-1.x-dev

Was committed on 6.x-1.x by deekayen. (Thanks.)

http://drupalcode.org/project/password_policy.git/commit/06574b5

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.