[Koha-bugs] [Bug 8861] New: Undefined variables in batchMod.pl trigger error logs

bugzilla-daemon at bugs.koha-community.org bugzilla-daemon at bugs.koha-community.org
Tue Oct 2 14:56:09 CEST 2012


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

          Priority: P5 - low
 Change sponsored?: ---
            Bug ID: 8861
          Assignee: gmcharlt at gmail.com
           Summary: Undefined variables in batchMod.pl trigger error logs
          Severity: minor
    Classification: Unclassified
                OS: All
          Reporter: mtompset at hotmail.com
          Hardware: All
            Status: NEW
           Version: master
         Component: Tools
           Product: Koha

This module was looked at because of:
[Tue Oct 02 17:00:56 2012] [error] [client 192.168.100.2] [Tue Oct  2 17:00:56
2012] batchMod.pl: Problem = a value of 1 has been passed to param without key
at /usr/share/koha/lib/C4/Templates.pm line 187.

There are two sections that match, though this was likely the $op case, not the
$error case:

$template->param(
    op      => $nextop,
    $op => 1,
);

foreach my $error (@errors) {
    $template->param($error => 1);
}

I would normally change:
    my $op           = $input->param('op');
into
    my $op           = $input->param('op') || q{};
However there was code that read:
    if (!defined $op) {
So, I looked to see how $op was used after that:
    if ($op eq "action") {
    if ($op eq "show"){
Of course, the above error'ing code, and lastly.
    if ($op eq "action") {
As such, I decided to define $op = q{} inside the if statement, after it ran
it's !defined check. And I still moved the $op => 1 to an external, conditional
template param call.

Additionally, I looked for where @errors was used in the file, but only the
declaration, and this foreach had a @errors reference. And as an array could be
filled with undef's, I err'd on the side of caution by adding "if $error" on
the template parameter call.

This was found in 3.8.5. Looks like it is master too.
Patch to follow shortly.

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


More information about the Koha-bugs mailing list