Bug 20422: Fix warning on uri_escape_utf8 in Output.pm
When opac-details calls parametrized_url, it triggers an uninitialized
warning when you would have a record without e.g. author, like:
Use of uninitialized value in subroutine entry at /usr/share/perl5/URI/Escape.pm line 184.
This is (imo) actually a bug in URI::Escape; it should check its args.
But we resolve the warning here by adding the "// q{}" in parametrized_url.
NOTE: Along the way we do something similar in the arrParamsBusc loop.
If the variable is undefined, jump to the next one. (Consistent with the
approach in the if-part preceding it.)
Test plan:
[1] Run t/Output.t again. Should pass now.
Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Brendan Gallagher <brendan@bywatersolutions.com>
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
This commit is contained in:
parent
d3503e8119
commit
5c3ead6ecd
|
|
@ -351,10 +351,10 @@ sub parametrized_url {
|
|||
my $vars = shift || {}; # ie { LANG => en }
|
||||
my $ret = $url;
|
||||
while ( my ($key,$val) = each %$vars) {
|
||||
my $val_url = URI::Escape::uri_escape_utf8($val);
|
||||
my $val_url = URI::Escape::uri_escape_utf8( $val // q{} );
|
||||
$ret =~ s/\{$key\}/$val_url/g;
|
||||
}
|
||||
$ret =~ s/\{[^\{]*\}//g; # remove not defined vars
|
||||
$ret =~ s/\{[^\{]*\}//g; # remove remaining vars
|
||||
return $ret;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -200,6 +200,7 @@ if ($session->param('busc')) {
|
|||
}
|
||||
} else {
|
||||
for my $value (@{$arrParamsBusc->{$_}}) {
|
||||
next if !defined($value);
|
||||
$pasarParams .= '&' if ($j);
|
||||
$pasarParams .= $_ . '=' . Encode::decode('UTF-8', uri_escape_utf8($value));
|
||||
$j++;
|
||||
|
|
|
|||
Loading…
Reference in New Issue