Bug 14555: Warns in opac-search.pl

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 <aleishaamohia@hotmail.com>

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
At step 2 you have to check a criteria

Signed-off-by: Brendan A Gallagher <brendan@bywatersolutions.com>
(cherry picked from commit ab81a0feee)
Signed-off-by: Julian Maurice <julian.maurice@biblibre.com>
(cherry picked from commit 34f20412f8)
Signed-off-by: Frédéric Demians <f.demians@tamil.fr>
This commit is contained in:
Martin Stenberg 2015-09-21 13:16:39 +02:00 committed by Frédéric Demians
parent fa83ce9b6e
commit 8e554c8581
1 changed files with 2 additions and 1 deletions

View File

@ -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) ) };