[Koha-bugs] [Bug 8880] New: Uninitialized variable triggers error log entry in circulation.pl

bugzilla-daemon at bugs.koha-community.org bugzilla-daemon at bugs.koha-community.org
Fri Oct 5 14:32:15 CEST 2012


http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=8880

          Priority: P5 - low
 Change sponsored?: ---
            Bug ID: 8880
                CC: gmcharlt at gmail.com, kyle.m.hall at gmail.com
          Assignee: koha-bugs at lists.koha-community.org
           Summary: Uninitialized variable triggers error log entry in
                    circulation.pl
          Severity: trivial
    Classification: Unclassified
                OS: All
          Reporter: mtompset at hotmail.com
          Hardware: All
            Status: NEW
           Version: unspecified
         Component: Circulation
           Product: Koha

I am using bug 8777 as a master bug with several sub-bug reports, as various
pieces may be accepted without issue, while others may need rebasing/refixing
which would hinder one giant patch.

This update overlaps with bug 8826, because the initialization of a hash is
within three lines of part of this fix. As such, I have made the same changes
in this patch. That is changed the initialization of the hashes from {} to ().

To verify potential side effects, I did a search through the circulation.pl
file for all occurrences of the variable initialized.

This patch initializes $findborrower
The error was triggered by trying to substitute on the very next line for an
undefined findborrower. An if statement on $findborrow functions the same for
undefined and q{}. And TT treats undefined as q{} as well. The || q{} should
prevent the error and have no changes in logic.

This patch initializes $barcode
The error was triggered by trying to substitute on the very next line for an
undefined barcode. The if condition on the following line behaves the same for
undefined and q{}. The stickyduedate check if condition on $barcode behaves the
same. The if condition to check "if we should print" now doesn't generate an
error log entry. The inprocess initialization should not trigger an error log
now. The next line's if still generates an error log due to a lack of the
charges parameter, not due to an undefined barcode. The "STEP 3 : ISSUING" if
condition behaves the same. There is no need to check inside the if, because
q{} does not run that code (just like undefined didn't). And TT treats
undefined as q{} as well. The || q{} should prevent errors and have no changes
in logic.

This patch initializes $print.
Make sure not to confuse it with $printer. :) The "if we should print" if
condition no longer generates an error log. However, the if condition
containing "$borrowernumber ne ''" still generates an error log, as
$borrowernumber is not initialized. Tracing the logic for $borrowernumber is
more difficult as external functions are called using it. The || q{} for $print
prevents an error and has no effect on the processing logic.

Test Plan
---------
1) Login to staff client
2) Circulation
3) Click the 'Check out' link.
4) Go check the error log.
Currently under 3.8.5 this generates error log entries for lines:
97,101,163,168,175,610,644, and 660 (in my testing on 3.8.5).
5) apply patch.
6) Home
7) Circulation
8) Click the 'Check out' link.
9) Go check the error log.
This should resolve lines 97, 101, 163, and 175 (under 3.8.5)

Patches to follow as master and 3.8.x differ.

-- 
You are receiving this mail because:
You are the assignee for the bug.
You are watching all bug changes.


More information about the Koha-bugs mailing list