Config parser: fail if a "select"-type option does not contain a scalar

This commit is contained in:
Maxime Besson 2020-04-07 18:01:15 +02:00
parent a9b1b6bc1d
commit 09ed2197df
2 changed files with 2 additions and 0 deletions

View File

@ -224,6 +224,7 @@ m[^(?:(?:\-+\s*BEGIN\s+(?:PUBLIC\s+KEY|CERTIFICATE)\s*\-+\r?\n)?[a-zA-Z0-9/\+\r\
},
'select' => {
'test' => sub {
return 0, 'Value is not a scalar' if ref $_[0];
my $test = grep( { $_ eq $_[0]; }
map( { $_->{'k'}; } @{ $_[2]{'select'}; } ) );
return $test

View File

@ -116,6 +116,7 @@ sub types {
},
select => {
test => sub {
return ( 0, "Value is not a scalar" ) if ref( $_[0] );
my $test = grep ( { $_ eq $_[0] }
map ( { $_->{k} } @{ $_[2]->{select} } ) );
return $test