From f0c04f93ab346b1949ff3bcb2a226c455dffbc51 Mon Sep 17 00:00:00 2001 From: Kevin Carnes Date: Thu, 9 Jun 2022 08:12:56 +0200 Subject: [PATCH] Bug 30844: Ensure that allow_nonref is enabled when using older versions of JSON --- opac/opac-detail.pl | 3 ++- opac/opac-search.pl | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/opac/opac-detail.pl b/opac/opac-detail.pl index f6b713542d..000eac3a51 100755 --- a/opac/opac-detail.pl +++ b/opac/opac-detail.pl @@ -250,7 +250,8 @@ if ($session->param('busc')) { eval { my $searcher = Koha::SearchEngine::Search->new( { index => $Koha::SearchEngine::BIBLIOS_INDEX } ); - ($error, $results_hashref, $facets) = $searcher->search_compat(decode_json($arrParamsBusc->{'query'}),$arrParamsBusc->{'simple_query'},\@sort_by,\@servers,$results_per_page,$offset,undef,$itemtypes,$arrParamsBusc->{'query_type'},$arrParamsBusc->{'scan'}); + my $json = JSON->new->utf8->allow_nonref(1); + ($error, $results_hashref, $facets) = $searcher->search_compat($json->decode($arrParamsBusc->{'query'}),$arrParamsBusc->{'simple_query'},\@sort_by,\@servers,$results_per_page,$offset,undef,$itemtypes,$arrParamsBusc->{'query_type'},$arrParamsBusc->{'scan'}); }; my $hits; my @newresults; diff --git a/opac/opac-search.pl b/opac/opac-search.pl index a1f0a14487..fb13bc5c56 100755 --- a/opac/opac-search.pl +++ b/opac/opac-search.pl @@ -561,7 +561,8 @@ if ($tag) { # displays search results which should be hidden. # FIXME: No facets for tags search. } else { - $pasarParams .= '&query=' . uri_escape_utf8(encode_json($query)); + my $json = JSON->new->utf8->allow_nonref(1); + $pasarParams .= '&query=' . uri_escape_utf8($json->encode($query)); $pasarParams .= '&count=' . uri_escape_utf8($results_per_page); $pasarParams .= '&simple_query=' . uri_escape_utf8($simple_query); $pasarParams .= '&query_type=' . uri_escape_utf8($query_type) if ($query_type); -- 2.17.1