Support from Acquia helps fund testing for Drupal Acquia logo

Comments

immoreel created an issue. See original summary.

immoreel’s picture

AohRveTPV’s picture

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

Thanks for the bug report and patch. This issue actually applies to 7.x-1.x, not 7.x-2.x.

AohRveTPV’s picture

Assigned: Unassigned » AohRveTPV

This problem is due to an invalid value being entered for the "Password Expiration Warning" field in the Password Policy configuration.

The validation code needs some improvement to disallow more or all invalid values:

  if (!empty($form_state['values']['warning']) && !preg_match('/^[0-9,]+$/', $form_state['values']['warning'])) {
    form_set_error('warning', t('Warning must only contain digits and commas.'));
  }

That regular expression would allow ,,,,, for example, which is invalid.

It would be better to fix it by disallowing invalid values instead of trying to cope with them by casting to int. I will attempt to improve the validation and share a patch. Thanks again for your bug report.

AohRveTPV’s picture

Status: Needs review » Needs work
AohRveTPV’s picture

Status: Needs review » Needs work
AohRveTPV’s picture

Really strange to me that that patch doesn't apply in testing.

AohRveTPV’s picture

immoreel, this bug is actually fixed in 7.x-1.x-dev since August: #2895670: Errors re invalid number on PHP7+. I think you must actually be using 7.x-1.14.

AohRveTPV’s picture

Title: Warning: A non-numeric value encountered in password_policy_user_login() » Add validation for expiration warning
Issue tags: -php7.1

The bug as reported is already fixed. Changing title of issue to reflect attempt to add validation for the field, to prevent some possible invalid values.

AohRveTPV’s picture

Status: Needs work » Needs review

Tests are now passing thanks to a fix on the drupal.org end.

The last submitted patch, 2: non-numeric value_2942407.diff, failed testing. View results

AohRveTPV’s picture

I don't know why it just now submitted #2 for testing. #7 is the relevant patch here.

  • AohRveTPV committed e2acd4c on 7.x-1.x
    Issue #2942407 by AohRveTPV: Add validation for expiration warning
    
AohRveTPV’s picture

Status: Needs review » Fixed

Status: Fixed » Closed (fixed)

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