From cc40bbf1952f67b2e46bae0cf71b8d4fbe0bea3d 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 Signed-off-by: Marcel de Rooy Signed-off-by: Tomas Cohen Arazi --- 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.39.5