Permalink
Browse files

Force scalar context for is_yes and is_no

This was exposed by an obscure bug in the Vend::UserDB constructor when $opt->{cgi} was defined but
did not match the underlying regex; since it was constructed in list context this resulted in an
odd-number of hash elements.

I reviewed all uses of is_yes and is_no in the code, none of which depend on being called in array
context.

Thanks to Jeff Boes <jeff@endpoint.com> for reporting.
  • Loading branch information...
machack666 committed Sep 13, 2012
1 parent f6a3f7f commit 1a00958f5ab8dd8b9bb79a24dfd77e3a5482b41a
Showing with 2 additions and 2 deletions.
  1. +2 −2 lib/Vend/Util.pm
View
@@ -1265,11 +1265,11 @@ sub readin {
}
sub is_yes {
- return( defined($_[0]) && ($_[0] =~ /^[yYtT1]/));
+ return scalar( defined($_[0]) && ($_[0] =~ /^[yYtT1]/));
}
sub is_no {
- return( !defined($_[0]) || ($_[0] =~ /^[nNfF0]/));
+ return scalar( !defined($_[0]) || ($_[0] =~ /^[nNfF0]/));
}
# Returns a URL which will run the ordering system again. Each URL

0 comments on commit 1a00958

Please sign in to comment.