Bug 41864 - (Bug 40966 follow-up) Simple OPAC search generates warnings: Odd number of elements in anonymous hash
Summary: (Bug 40966 follow-up) Simple OPAC search generates warnings: Odd number of el...
Status: Signed Off
Alias: None
Product: Koha
Classification: Unclassified
Component: Architecture, internals, and plumbing (show other bugs)
Version: unspecified
Hardware: All All
: P5 - low normal
Assignee: Bugs List
QA Contact: Testopia
URL:
Keywords:
Depends on: 40966
Blocks:
  Show dependency treegraph
 
Reported: 2026-02-17 14:17 UTC by Janusz Kaczmarek
Modified: 2026-02-18 17:32 UTC (History)
1 user (show)

See Also:
GIT URL:
Initiative type: ---
Sponsorship status: Sponsored
Comma delimited list of Sponsors:
Crowdfunding goal: 0
Patch complexity: Trivial patch
Documentation contact:
Documentation submission:
Text to go in the release notes:
Version(s) released in:
Circulation function:


Attachments
Bug 41864: (Bug 40966 follow-up) Simple OPAC search generates warnings: Odd number of elements in anonymous hash (1.48 KB, patch)
2026-02-18 11:31 UTC, Janusz Kaczmarek
Details | Diff | Splinter Review
Bug 41864: (Bug 40966 follow-up) Simple OPAC search generates warnings: Odd number of elements in anonymous hash (1.53 KB, patch)
2026-02-18 17:32 UTC, Roman Dolny
Details | Diff | Splinter Review

Note You need to log in before you can comment on or make changes to this bug.
Description Janusz Kaczmarek 2026-02-17 14:17:52 UTC
After introducing Bug 40966 opac-search.pl, when invoked in the 
simple form (not as advanced search) generates warnings like:

[WARN] Odd number of elements in anonymous hash at /kohadevbox/koha/opac/opac-search.pl line 529.

This is because 'weight_search_submitted' is not initialized for 
this search.

You get the same effect with this simple test:

#!/usr/bin/perl
use Modern::Perl;
use Data::Dumper;

say Dumper(
    {
        one => 1,
        two => &und
    }
);

sub und {

    #return undef;
}


But if you uncomment 'return undef', there is no warning.

So most probably, in this case, $cgi->param('weight_search_submitted') 
returns an empty list, not an undef.
Comment 1 Janusz Kaczmarek 2026-02-18 11:31:31 UTC
Created attachment 193341 [details] [review]
Bug 41864: (Bug 40966 follow-up) Simple OPAC search generates warnings: Odd number of elements in anonymous hash

After introducing Bug 40966 opac-search.pl, when invoked in the
simple form (not as advanced search) generates warnings like:

[WARN] Odd number of elements in anonymous hash at /kohadevbox/koha/opac/opac-search.pl line 529.

Test plan:
==========
1. Perform a simple search from main OPAC page.
2. Check the content of plack-opac-error.log. You should see a
   warning like:
   [WARN] Odd number of elements in anonymous hash at /kohadevbox/koha/opac/opac-search.pl line 529.
3. Apply the patch ; restart_all.
4. Repeat p. 1. There should be no new warning now.

Sponsored-by: Ignatianum University in Cracow
Comment 2 Roman Dolny 2026-02-18 17:32:15 UTC
Created attachment 193362 [details] [review]
Bug 41864: (Bug 40966 follow-up) Simple OPAC search generates warnings: Odd number of elements in anonymous hash

After introducing Bug 40966 opac-search.pl, when invoked in the
simple form (not as advanced search) generates warnings like:

[WARN] Odd number of elements in anonymous hash at /kohadevbox/koha/opac/opac-search.pl line 529.

Test plan:
==========
1. Perform a simple search from main OPAC page.
2. Check the content of plack-opac-error.log. You should see a
   warning like:
   [WARN] Odd number of elements in anonymous hash at /kohadevbox/koha/opac/opac-search.pl line 529.
3. Apply the patch ; restart_all.
4. Repeat p. 1. There should be no new warning now.

Sponsored-by: Ignatianum University in Cracow
Signed-off-by: Roman Dolny <roman.dolny@jezuici.pl>