From 293feb158284469a1dd14240fab68da08ed6f68a 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] Content-Type: text/plain; charset=utf-8 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. --- C4/Search.pm | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/C4/Search.pm b/C4/Search.pm index c1a21e9ce2..d1df39defb 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.11.0