You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Validation rules DSL syntax is not checked (at least in 'like' rules).
This may lead to silently passing through invalid data when programmer makes a mistake.
In the following example rules 'like' and 'max_length' are not properly separated which is difficult to spot. The result is that the check is enforced only some of the time (depending on the perl hash walking order which is different each run).
use Test::More;
use Validator::LIVR qw();
my $validator = Validator::LIVR->new({
# wrong line:
field => ['required', {like => "^[A-Za-z]+\$", max_length => 20}],
# correct line:
# field => ['required', {like => "^[A-Za-z]+\$"}, {max_length => 20}],
});
my $passed_fields = $validator->validate( { field => "invalid_data" } );
ok ! $passed_fields, 'invalid data is not allowed';
done_testing;
The text was updated successfully, but these errors were encountered:
Validation rules DSL syntax is not checked (at least in 'like' rules).
This may lead to silently passing through invalid data when programmer makes a mistake.
In the following example rules 'like' and 'max_length' are not properly separated which is difficult to spot. The result is that the check is enforced only some of the time (depending on the perl hash walking order which is different each run).
The text was updated successfully, but these errors were encountered: