From e3c8ba65cff48d598c810f9def4f654c79dd0669 Mon Sep 17 00:00:00 2001 From: Marcel de Rooy Date: Fri, 10 Jan 2020 08:27:39 +0000 Subject: [PATCH] Bug 24367: Resolve warn Use of uninitialized value within [arrays] Use of uninitialized value within @operators in string eq at /usr/share/koha/C4/Search.pm line 1362. Use of uninitialized value within @indexes in pattern match (m//) at /usr/share/koha/C4/Search.pm line 1367. Trivial tests added. Signed-off-by: Martin Renvoize --- C4/Search.pm | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/C4/Search.pm b/C4/Search.pm index 4ca9e01427..1b5c7eb878 100644 --- a/C4/Search.pm +++ b/C4/Search.pm @@ -1359,12 +1359,12 @@ sub parseQuery { $query = ''; for ( my $ii = 0 ; $ii <= @operands ; $ii++ ) { next unless $operands[$ii]; - $query .= $operators[ $ii - 1 ] eq 'or' ? ' || ' : ' && ' + $query .= $operators[$ii-1] && $operators[ $ii - 1 ] eq 'or' ? ' || ' : ' && ' if ($query); if ( $operands[$ii] =~ /^[^"]\W*[-|_\w]*:\w.*[^"]$/ ) { $query .= $operands[$ii]; } - elsif ( $indexes[$ii] =~ m/su-/ ) { + elsif ( $indexes[$ii] && $indexes[$ii] =~ m/su-/ ) { $query .= $indexes[$ii] . '(' . $operands[$ii] . ')'; } else { -- 2.39.5