Bug 27548 - Warnings "use of uninitialized value" on branchoverdues.pl
Summary: Warnings "use of uninitialized value" on branchoverdues.pl
Status: Pushed to oldoldstable
Alias: None
Product: Koha
Classification: Unclassified
Component: Circulation (show other bugs)
Version: master
Hardware: All All
: P5 - low trivial (vote)
Assignee: Peter Vashchuk
QA Contact: Testopia
URL:
Keywords:
Depends on:
Blocks: 25790
  Show dependency treegraph
 
Reported: 2021-01-25 15:34 UTC by Peter Vashchuk
Modified: 2021-02-11 21:49 UTC (History)
8 users (show)

See Also:
Change sponsored?: ---
Patch complexity: Trivial patch
Text to go in the release notes:
This fixes the cause of unnecessary "use of uninitialized value" warnings in the log files generated by Circulation > Overdues with fines (/cgi-bin/koha/circ/branchoverdues.pl). This was caused by not taking into account that the "location" parameter for this form is initially empty.
Version(s) released in:
21.05.00, 20.11.03,20.05.09,19.11.15


Attachments
Bug 27548: "use of uninitialized value" warning on branchoverdues.pl (1.71 KB, patch)
2021-01-25 15:35 UTC, Peter Vashchuk
Details | Diff | Splinter Review
Bug 27548: "use of uninitialized value" warning on branchoverdues.pl (1.76 KB, patch)
2021-01-25 23:23 UTC, David Nind
Details | Diff | Splinter Review
Bug 27548: "use of uninitialized value" warning on branchoverdues.pl (1.83 KB, patch)
2021-01-31 13:09 UTC, Katrin Fischer
Details | Diff | Splinter Review

Note You need to log in before you can comment on or make changes to this bug.
Description Peter Vashchuk 2021-01-25 15:34:12 UTC

    
Comment 1 Peter Vashchuk 2021-01-25 15:35:59 UTC
Created attachment 115781 [details] [review]
Bug 27548: "use of uninitialized value" warning on branchoverdues.pl

On the beginning we have empty "location" parameter for this form, but that not taken into account in comparison and undef warning emitted: "Use of uninitialized value $location in string eq at /usr/share/koha/intranet/cgi-bin/circ/branchoverdues.pl line 72" in branchoverdues.pl
Fixed by adding pre-check for $location.

To reproduce:
    1) Head over to "Circulation ->Overdues with fines" page. Check intranet-error.log where there will be many warnings "Use of uninitialized value $location in string eq at /usr/share/koha/intranet/cgi-bin/circ/branchoverdues.pl line 72".
    2) Apply the patch, refresh the "Overdues with fines" page.
    3) Ensure that the new "use of uninitialized value" warnings didn't appear in the console.
Comment 2 David Nind 2021-01-25 23:23:01 UTC
Created attachment 115794 [details] [review]
Bug 27548: "use of uninitialized value" warning on branchoverdues.pl

On the beginning we have empty "location" parameter for this form, but that not taken into account in comparison and undef warning emitted: "Use of uninitialized value $location in string eq at /usr/share/koha/intranet/cgi-bin/circ/branchoverdues.pl line 72" in branchoverdues.pl
Fixed by adding pre-check for $location.

To reproduce:
    1) Head over to "Circulation ->Overdues with fines" page. Check intranet-error.log where there will be many warnings "Use of uninitialized value $location in string eq at /usr/share/koha/intranet/cgi-bin/circ/branchoverdues.pl line 72".
    2) Apply the patch, refresh the "Overdues with fines" page.
    3) Ensure that the new "use of uninitialized value" warnings didn't appear in the console.

Signed-off-by: David Nind <david@davidnind.com>
Comment 3 David Nind 2021-01-25 23:24:20 UTC
Testing notes:
- When using koha-testing-docker the warnings are logged to /var/log/koha/kohadev/plack-intranet-error.log
Comment 4 Katrin Fischer 2021-01-31 13:09:36 UTC
Created attachment 116099 [details] [review]
Bug 27548: "use of uninitialized value" warning on branchoverdues.pl

On the beginning we have empty "location" parameter for this form,
but that not taken into account in comparison and undef warning emitted:
"Use of uninitialized value $location in string eq at
/usr/share/koha/intranet/cgi-bin/circ/branchoverdues.pl line 72" in branchoverdues.pl

Fixed by adding pre-check for $location.

To reproduce:
    1) Head over to "Circulation ->Overdues with fines" page. Check
       intranet-error.log where there will be many warnings
       "Use of uninitialized value $location in string eq at /usr/share/koha/intranet/cgi-bin/circ/branchoverdues.pl line 72".
    2) Apply the patch, refresh the "Overdues with fines" page.
    3) Ensure that the new "use of uninitialized value" warnings didn't appear in the console.

Signed-off-by: David Nind <david@davidnind.com>

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Comment 5 Katrin Fischer 2021-01-31 13:10:25 UTC
I've reformatted the commit message a little bit for better readability on command line (adding line breaks).
Comment 6 Jonathan Druart 2021-02-01 16:27:06 UTC
Pushed to master for 21.05, thanks to everybody involved!
Comment 7 Fridolin Somers 2021-02-05 16:12:26 UTC
Pushed to 20.11.x for 20.11.03
Comment 8 Andrew Fuerste-Henry 2021-02-09 21:26:12 UTC
Pushed to 20.05.x for 20.05.09
Comment 9 Victor Grousset/tuxayo 2021-02-11 05:40:35 UTC
Backported: Pushed to 19.11.x branch for 19.11.15