From 8e554c858137c5a16d52fc96e24128e45d56a416 Mon Sep 17 00:00:00 2001 From: Martin Stenberg Date: Mon, 21 Sep 2015 13:16:39 +0200 Subject: [PATCH] Bug 14555: Warns in opac-search.pl MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Avoid use of uninitialized value in split == Test plan == 1. Go to opac advanced search 2. Click "Search" without any search query 3. Log file will show "Use of uninitialized value in split at ..." 4. Apply this patch 5. Repeat step 1 and 2 6. Log file should no longer show "Use of uninitialized value in split at ..." Sponsored-by: Regionbibliotek Halland / County library of Halland Signed-off-by: Aleisha Signed-off-by: Jonathan Druart At step 2 you have to check a criteria Signed-off-by: Brendan A Gallagher (cherry picked from commit ab81a0feeebf1c01857755f53060dcc255960e9b) Signed-off-by: Julian Maurice (cherry picked from commit 34f20412f89e9320e0fe2a0a3778a3e680566ec3) Signed-off-by: Frédéric Demians --- opac/opac-search.pl | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/opac/opac-search.pl b/opac/opac-search.pl index 6a283b18b2..c3faebe309 100755 --- a/opac/opac-search.pl +++ b/opac/opac-search.pl @@ -498,7 +498,8 @@ my @results; sub _input_cgi_parse { my @elements; - for my $this_cgi ( split('&',shift) ) { + my $query_cgi = shift or return @elements; + for my $this_cgi ( split('&',$query_cgi) ) { next unless $this_cgi; $this_cgi =~ /(.*?)=(.*)/; push @elements, { input_name => $1, input_value => Encode::decode_utf8( uri_unescape($2) ) }; -- 2.39.5