Bugzilla – Attachment 72953 Details for
Bug 20422
Fix warn on URI/Escape.pm line 184 from opac-detail
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 20422: Fix warning on uri_escape_utf8 in Output.pm
Bug-20422-Fix-warning-on-uriescapeutf8-in-Outputpm.patch (text/plain), 2.11 KB, created by
Marcel de Rooy
on 2018-03-15 13:35:43 UTC
(
hide
)
Description:
Bug 20422: Fix warning on uri_escape_utf8 in Output.pm
Filename:
MIME Type:
Creator:
Marcel de Rooy
Created:
2018-03-15 13:35:43 UTC
Size:
2.11 KB
patch
obsolete
>From 66a86e36c069f0e002c8ab35d29e8efb3a2c6764 Mon Sep 17 00:00:00 2001 >From: Marcel de Rooy <m.de.rooy@rijksmuseum.nl> >Date: Thu, 15 Mar 2018 12:37:11 +0100 >Subject: [PATCH] Bug 20422: Fix warning on uri_escape_utf8 in Output.pm >Content-Type: text/plain; charset=utf-8 > >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> >--- > C4/Output.pm | 4 ++-- > opac/opac-detail.pl | 1 + > 2 files changed, 3 insertions(+), 2 deletions(-) > >diff --git a/C4/Output.pm b/C4/Output.pm >index 1b3ee48..39d9f9c 100644 >--- a/C4/Output.pm >+++ b/C4/Output.pm >@@ -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; > } > >diff --git a/opac/opac-detail.pl b/opac/opac-detail.pl >index e7653d9..fd51ce1 100755 >--- a/opac/opac-detail.pl >+++ b/opac/opac-detail.pl >@@ -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++; >-- >2.1.4
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 20422
:
72952
|
72953
|
72954
|
72955
|
73210
|
73211