Bug 8772 - Uninitialized variable triggers error log entry in smart_rules.pl
Summary: Uninitialized variable triggers error log entry in smart_rules.pl
Status: CLOSED FIXED
Alias: None
Product: Koha
Classification: Unclassified
Component: Circulation (show other bugs)
Version: 3.8
Hardware: All All
: P5 - low trivial (vote)
Assignee: M. Tompsett
QA Contact:
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2012-09-14 17:17 UTC by M. Tompsett
Modified: 2013-05-23 06:23 UTC (History)
5 users (show)

See Also:
Change sponsored?: ---
Patch complexity: ---
Who signed the patch off:
Text to go in the release notes:
Version(s) released in:


Attachments
Added "|| q{}" into variable declaration/initialization (1.04 KB, patch)
2012-09-18 16:16 UTC, M. Tompsett
Details | Diff | Splinter Review
[SIGNED-OFF] Bug 8772 - Uninitialized variable triggers error log entry in smart_rules.pl (1.36 KB, patch)
2012-09-18 18:06 UTC, Marc Véron
Details | Diff | Splinter Review

Note You need to log in before you can comment on or make changes to this bug.
Description M. Tompsett 2012-09-14 17:17:11 UTC
Test
----
1) Login
2) Go to administration
3) Circulations and Fines
4) tail /var/log/koha/...
There's now several uninitialized $op variables.
5) apply a patch that changes line 47 (where the my $op) is to have "|| q{}"
6) retest no errors.

Sorry, it's late. No time for a patch.
Comment 1 M. Tompsett 2012-09-18 16:16:14 UTC Comment hidden (obsolete)
Comment 2 Marc Véron 2012-09-18 18:06:02 UTC
Created attachment 12320 [details] [review]
[SIGNED-OFF] Bug 8772 - Uninitialized variable triggers error log entry in smart_rules.pl

Changed declartion from:
  my $op = $input->param('op');
to
  my $op = $input->param('op') || q{};
in order to give an empty string default preventing error
logs from filling needlessly.

Signed-off-by: Marc Veron <veron@veron.ch>

The patch removes warnings like:
Use of uninitialized value $op in string eq at...

However there is one more warning, but it is not related to $op (addressed by this patch):
smart-rules.pl: Use of uninitialized value in string ne at .../admin/smart-rules.pl line 388.
Comment 3 Paul Poulain 2012-10-09 09:52:42 UTC
QA comment:
 * tiny & trivial patch, that just silence a warn
 * passes koha-qa.pl

passed QA
Comment 4 Paul Poulain 2012-10-09 09:55:22 UTC
Patch pushed to master.

Still 2 warns, but not related to this patch:

Use of uninitialized value in string ne at /home/paul/koha.dev/koha-community/admin/smart-rules.pl line 388.
Use of uninitialized value in sprintf at /home/paul/koha.dev/koha-community/admin/smart-rules.pl line 387.
Comment 5 Chris Cormack 2012-10-09 21:37:01 UTC
Pushed to 3.8.x, will be in 3.8.6