Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Validation::_validation_match_field() - empty field gives positive match #890

Closed
quetzyg opened this issue Mar 27, 2012 · 2 comments
Closed
Labels
Milestone

Comments

@quetzyg
Copy link
Contributor

quetzyg commented Mar 27, 2012

When validating a field to see if it matches a previous one, a false positive match is returned if the later is empty.

Steps to reproduce:

  • Create the validation object and add a match_field rule:
    $val = Validation::forge();
    $val->add('password_confirm', 'Password (confirm)')->add_rule('match_field', 'password');
  • Fill the first field (password) with any string besides an empty one
  • Leave the password_confirm field empty
  • Run the validation:
    $val->run()
  • It will return: true
@jschreuder
Copy link
Contributor

First thoughts as given on IRC: contrary to other validation rules, match_field should not be ignored when empty.

@WanWizard
Copy link
Member

Unless the field that is matched again is empty too. I'll fix it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants