From 8d57ef995b90a67316f6df3cf831c9160347593d Mon Sep 17 00:00:00 2001 From: =?utf8?q?Joonas=20Kylm=C3=A4l=C3=A4?= Date: Tue, 3 Nov 2020 12:27:14 +0200 Subject: [PATCH] Bug 24567: (QA follow-up) Remove warning in regex MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Without this patch we get Use of uninitialized value $3 in concatenation (.) or string at /kohadevbox/koha/Koha/SearchEngine/Elasticsearch/QueryBuilder.pm line 943. This converts the | OR operator to two different regexes so that the capture group variables will be defined in every case. Signed-off-by: Joonas Kylmälä Signed-off-by: Jonathan Druart (cherry picked from commit ea7e83b2712c48a0c9a157b2fb36eb782b26f34b) Signed-off-by: Andrew Fuerste-Henry --- Koha/SearchEngine/Elasticsearch/QueryBuilder.pm | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Koha/SearchEngine/Elasticsearch/QueryBuilder.pm b/Koha/SearchEngine/Elasticsearch/QueryBuilder.pm index 605feb5e6c..bb5763e990 100644 --- a/Koha/SearchEngine/Elasticsearch/QueryBuilder.pm +++ b/Koha/SearchEngine/Elasticsearch/QueryBuilder.pm @@ -941,7 +941,8 @@ sub _clean_search_term { } # Remove unquoted colons that have whitespace on either side of them - $term =~ s/((:+)(\s+)|(\s+)(:+))$lookahead/$3$4/g; + $term =~ s/(:+)(\s+)$lookahead/$2/g; + $term =~ s/(\s+)(:+)$lookahead/$1/g; $term = $self->_query_regex_escape_process($term); -- 2.39.5