| Summary: | Undefined variables in batchMod.pl trigger error logs | ||
|---|---|---|---|
| Product: | Koha | Reporter: | Mark Tompsett <mtompset> |
| Component: | Tools | Assignee: | Mark Tompsett <mtompset> |
| Status: | CLOSED FIXED | QA Contact: | Jonathan Druart <jonathan.druart> |
| Severity: | minor | ||
| Priority: | P5 - low | CC: | chris, jonathan.druart, kyle, paul.poulain |
| Version: | 3.10 | ||
| Hardware: | All | ||
| OS: | All | ||
| GIT URL: | Initiative type: | --- | |
| Sponsorship status: | --- | Crowdfunding goal: | 0 |
| Patch complexity: | --- | Documentation contact: | |
| Documentation submission: | Text to go in the release notes: | ||
| Version(s) released in: | Circulation function: | ||
| Attachments: |
Fix inconsequential error loggling in batchMod.pl
Fix inconsequential error loggling in batchMod.pl (3.8, 3.6) [SIGNED-OFF] Bug 8861 - Undefined variables in batchMod.pl trigger error logs [SIGNED-OFF] Bug 8861 - Undefined variables in batchMod.pl trigger error logs (3.8, 3.6) |
||
Created attachment 12635 [details] [review] Fix inconsequential error loggling in batchMod.pl Test ==== 1) Login to staff client 2) Tools 3) Batch item modification 4) check intranet error logs. Should see error like: [Tue Oct 02 21:13:19 2012] [error] [client 192.168.100.2] [Tue Oct 2 21:13:19 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., 5) apply patch 6) Tools 7) Batch item modification 8) check intranet error logs. Error should not be created. This the master version patch. Created attachment 12636 [details] [review] Fix inconsequential error loggling in batchMod.pl (3.8, 3.6) Should be the same tests as above. This patch should apply to 3.8.x and 3.6.x versions. This was tested in 3.8.5. Created attachment 12708 [details] [review] [SIGNED-OFF] Bug 8861 - Undefined variables in batchMod.pl trigger error logs Initialized $op, and changed lines like "$op => 1" and "$error => 1" into separate, conditional template param calls. Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com> Created attachment 12709 [details] [review] [SIGNED-OFF] Bug 8861 - Undefined variables in batchMod.pl trigger error logs (3.8, 3.6) Initialized $op, and changed lines like "$op => 1" and "$error => 1" into separate, conditional template param calls. Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com> Looks good, marked as Passed QA. Patch pushed to master Pushed to 3.8.x will be in 3.8.12 |
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.