Bugzilla – Attachment 122304 Details for
Bug 28572
Replace C4::Debug with Koha::Logger->debug
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 28572: Avoid useless warnings
Bug-28572-Avoid-useless-warnings.patch (text/plain), 2.90 KB, created by
Tomás Cohen Arazi (tcohen)
on 2021-06-22 19:45:41 UTC
(
hide
)
Description:
Bug 28572: Avoid useless warnings
Filename:
MIME Type:
Creator:
Tomás Cohen Arazi (tcohen)
Created:
2021-06-22 19:45:41 UTC
Size:
2.90 KB
patch
obsolete
>From 35bc5fbba846f8a6778570eccc9362ac48154f9a Mon Sep 17 00:00:00 2001 >From: Tomas Cohen Arazi <tomascohen@theke.io> >Date: Tue, 22 Jun 2021 16:41:55 -0300 >Subject: [PATCH] Bug 28572: Avoid useless warnings > >There are too many warnings about uninitialized variables in Search.pm. >This patch deals with that, the same way it is dealt accross the file: >by setting an empty string when things are not defined. > >To test: >1. Run: > $ kshell > k$ prove t/db_dependent/Search.t >=> FAIL: Wow, too many warnings. Some related to this bug, some not. >2. Apply this patch >3. Repeat 1 >=> SUCCESS: No more warnings! >4. Sign off :-D > >Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io> >--- > C4/Search.pm | 20 +++++++++++--------- > 1 file changed, 11 insertions(+), 9 deletions(-) > >diff --git a/C4/Search.pm b/C4/Search.pm >index b0ebedcb57..18ea9f02af 100644 >--- a/C4/Search.pm >+++ b/C4/Search.pm >@@ -1197,7 +1197,7 @@ sub buildQuery { > my $weight_fields = C4::Context->preference("QueryWeightFields") || 0; > my $fuzzy_enabled = C4::Context->preference("QueryFuzzy") || 0; > >- my $query = $operands[0]; >+ my $query = $operands[0] // ""; > my $simple_query = $operands[0]; > > # initialize the variables we're passing back >@@ -1350,7 +1350,7 @@ sub buildQuery { > } > > # Detect Truncation >- my $truncated_operand; >+ my $truncated_operand = q{}; > my( $nontruncated, $righttruncated, $lefttruncated, > $rightlefttruncated, $regexpr > ) = _detect_truncation( $operand, $index ); >@@ -1392,14 +1392,14 @@ sub buildQuery { > Koha::Logger->get->debug("TRUNCATED OPERAND: >$truncated_operand<"); > > # Handle Stemming >- my $stemmed_operand; >+ my $stemmed_operand = q{}; > $stemmed_operand = _build_stemmed_operand($operand, $lang) > if $stemming; > > Koha::Logger->get->debug("STEMMED OPERAND: >$stemmed_operand<"); > > # Handle Field Weighting >- my $weighted_operand; >+ my $weighted_operand = q{}; > if ($weight_fields) { > $weighted_operand = _build_weighted_query( $operand, $stemmed_operand, $index ); > $operand = $weighted_operand; >@@ -1506,11 +1506,13 @@ sub buildQuery { > $query =~ s/(?<=(st-date-normalized)):/=/g; > > # Removing warnings for later substitutions >- $query //= q{}; >- $query_desc //= q{}; >- $query_cgi //= q{}; >- $limit //= q{}; >- $limit_desc //= q{}; >+ $query //= q{}; >+ $query_desc //= q{}; >+ $query_cgi //= q{}; >+ $limit //= q{}; >+ $limit_desc //= q{}; >+ $limit_cgi //= q{}; >+ $simple_query //= q{}; > $limit =~ s/:/=/g; > for ( $query, $query_desc, $limit, $limit_desc ) { > s/ +/ /g; # remove extra spaces >-- >2.32.0
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 28572
:
122118
|
122147
|
122216
|
122217
|
122218
|
122290
|
122291
|
122303
|
122304