valitron icon indicating copy to clipboard operation
valitron copied to clipboard

Error in lengthBetween and lengthMin rule

Open Sleon4 opened this issue 2 years ago • 0 comments

I have been implementing these normal for the validations of a registration form where we depend on the minimum length of a specific string, For example: identification: "1000000001"

This, when used in standards as the documentation dictates, is as follows:

$rules = [
	'required' => [
		['identification']
	],
	'lengthMin' => [
		['identification', 2]
	]
];

If we look at the rules structure that we are going to use it is correct, but when the information comes in with a string '' it takes it as true and ignores this. The error implies that lengthBetween and lengthMin are not taking the expected minimum length, accepting that input '' is true when in fact it should be false.

Sleon4 avatar May 05 '22 13:05 Sleon4