hi,
after updating to 1.7 version by drush upc, i had this warning :
Division by zero password_policy.install:360

actually

$sandbox['password_count'] = db_query("SELECT COUNT(pid) FROM {password_policy_history}")->fetchField();

is returning 0 as there is no password in the database yet for me.

so

      $sandbox['#finished'] = $sandbox['password_from'] / $sandbox['password_count'];

is currenty deviding by 0

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

izus’s picture

Status: Active » Needs review
FileSize
3.34 KB

hi,
here is a patch for this.
Thanks

AohRveTPV’s picture

Priority: Normal » Major

Thanks for reporting it and for the patch.

I don't think there are any problems caused by the update failing, but we should probably do another release soon to include this fix.

AohRveTPV’s picture

Here is a patch that fixes it in another way. I prefer this way because it only changes a line and keeps the update code easy to diff against user_update_7000(). Also I think patch in #1 might perform a query for each execution of password_policy_update_7102() (it is a batch API function so it gets invoked multiple times).

AohRveTPV’s picture

Status: Needs review » Needs work

Whoops, that patch was wrong...

AohRveTPV’s picture

Status: Needs work » Needs review
FileSize
563 bytes

New patch for 7.x-1.x. 7.x-2.0-alpha2 also has this bug, and the same change should fix it.

AohRveTPV’s picture

Again the patch is wrong...

AohRveTPV’s picture

OK, this one is better tested. I tested two cases:
1. No entries in {password_policy_history} => no division by zero error
2. Enough entries in {password_policy_history} to require multiple batch chunks => all password hashes converted

  • Commit 1ce72bb on 7.x-1.x by AohRveTPV:
    Issue #2289023 by izus, AohRveTPV: password_policy.install division by...
  • Commit ec431e5 on 7.x-2.x by AohRveTPV:
    Issue #2289023 by izus, AohRveTPV: password_policy.install division by...
AohRveTPV’s picture

Status: Needs review » Fixed

Status: Fixed » Closed (fixed)

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