If I try to enforce a delay constraint, when a user tries to change their password, they receive the following error:

Fatal error: Call to a member function condition() on a non-object in /path/to/site/sites/all/modules/password_policy/constraints/constraint_delay.inc on line 34

Call Stack:
0.0001 650360 1. {main}() /path/to/site/index.php:0
0.2158 4607960 2. menu_execute_active_handler() /path/to/site/index.php:22
0.2207 4844584 3. call_user_func_array() /path/to/site/includes/menu.inc:501
0.2208 4845200 4. drupal_get_form() /path/to/site/includes/menu.inc:0
0.2208 4846600 5. drupal_build_form() /path/to/site/includes/form.inc:188
0.5276 5936184 6. drupal_process_form() /path/to/site/includes/form.inc:350
0.5453 6223240 7. drupal_validate_form() /path/to/site/includes/form.inc:819
0.5454 6224152 8. _form_validate() /path/to/site/includes/form.inc:1084
0.5594 6327264 9. form_execute_handlers() /path/to/site/includes/form.inc:1331
0.6819 7498344 10. password_policy_password_validate() /path/to/site/includes/form.inc:1390
0.6819 7498424 11. _password_policy_constraint_validate() /path/to/site/sites/all/modules/password_policy/password_policy.module:642
0.6820 7499608 12. call_user_func() /path/to/site/sites/all/modules/password_policy/password_policy.module:806
0.6820 7499680 13. password_policy_constraint_delay_validate() /path/to/site/sites/all/modules/password_policy/password_policy.module:0

Comments

matt v.’s picture

Version: 7.x-1.0-rc2 » 7.x-1.x-dev
Priority: Normal » Critical
Status: Active » Needs review
StatusFileSize
new3.18 KB

It turns out I should have done a more thorough review of the patch in #1364764: Delay constraint needs to be converted to D7 database api that ultimately got applied. This issue turns out to be a problem with the delay constraint patch that in my review didn't get triggered by the existing tests.

The earlier 1364764-delay-constraint-convert-to-dbtng-2.patch seems to fix the problem just fine.

I'm attaching a test file patch that illustrates the problem (borrowing heavily from the history constraint test). If you apply the attached test update, running the the tests before applying 1364764-delay-constraint-convert-to-dbtng-2.patch results in an error. After applying 1364764-delay-constraint-convert-to-dbtng-2.patch, all the tests pass.

erikwebb’s picture

Agreed. I'll roll back to that patch. Attached is the full patch including your test and the bug fix. Please test and confirm.

matt v.’s picture

Status: Needs review » Reviewed & tested by the community

I've tested again and confirmed that the patch in comment #2 above fixes the issue for me. I'm going ahead and marking it RTBC, but if you'd rather get confirmation from someone else, that's certainly understandable.

erikwebb’s picture

Status: Reviewed & tested by the community » Fixed

This is a pretty big bug. I'll go ahead and push it out.

http://drupalcode.org/project/password_policy.git/commit/ead15e0

Status: Fixed » Closed (fixed)

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