Open GrishinSergey opened 6 years ago
The problem is a combination of a poor error message and a (small) mistake in your code. The good news is: the mistake is easy to fix.
I'm taking only the part that is causing the problem:
$this->validator->rule("equals", [self::PASSWORD_KEY_NAME, self::CONFIRM_KEY_NAME]);
This line tells our validator 'check that both the password and the confirm field have the same value as an undefined (null) field. That's of course not supposed to happen, which is why the error message doesn't get generated correctly as you can see by the vsprintf()-related errors.
What you want to do is:
$this->validator->rule("equals", self::PASSWORD_KEY_NAME, self::CONFIRM_KEY_NAME);
Which is 'check that the value of the password field equals that of the confirm field'.
TODO: throw an exception for wrong parameter count
Thank you for help. Yes, will be cool, if library throws an exception, when params not correctly passed? BTW, how about set types as standart PHP7?
PHP7 types etc will be for the 2.x version, whenever I get round do that. Might be a while still, I'm afraid :/
Hello, I use this library for validation registration form. But, when I try to check two fields - password and confirmPassword to equality with "equals" rule, it works incorrectly. Firslty, I saw the same Notises and Warnings:
Than, I check result of validation and it's false for set of data: password=11111111 confirmPassword=11111111
Other rules returs true. An error only with "euals"
My full validation code
PASSWORD_MIN_LENGTH = 8 (so, there can't been problems with this)