Bug 28880

Summary: Warning in tr (at Mojo/Headers.pm) because of undef X-Base-Total-Count HTTP header value
Product: Koha Reporter: Andrii Nugged <nugged>
Component: REST APIAssignee: Bugs List <koha-bugs>
Status: NEW --- QA Contact:
Severity: trivial    
Priority: P5 - low CC: jonathan.druart, stalkernoid, tomascohen
Version: Main   
Hardware: All   
OS: All   
See Also: https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=25790
Change sponsored?: --- Patch complexity: ---
Documentation contact: Documentation submission:
Text to go in the release notes:
Version(s) released in:
Bug Depends on: 27353    
Bug Blocks:    

Description Andrii Nugged 2021-08-18 18:24:41 UTC
There was an introduced X-Base-Total-Count header for REST API in Bug 27353.

When used from external plugins and "base_total" not provided (is it mandatory?) all logs are heavily filled with:

    [WARN] Use of uninitialized value $_ in transliteration (tr///)
           at /usr/share/perl5/Mojo/Headers.pm line 43.

It's because X-Base-Total-Count comes with "undef" as I debugged,
what solution to choose:

A. should we demand this value from plugin creators?
B. or should we add this (not "0" as default, anyway, right?):

    my $base_total = $args->{base_total} // $total;

to Koha/REST/Plugin/Pagination.pm line 63?