Bug 8886

Summary: Uninitialized variable triggers error log entry in z3950_search.pl
Product: Koha Reporter: Mark Tompsett <mtompset>
Component: AcquisitionsAssignee: Mark Tompsett <mtompset>
Status: RESOLVED DUPLICATE QA Contact:
Severity: minor    
Priority: P5 - low CC: chris
Version: unspecified   
Hardware: All   
OS: All   
Change sponsored?: --- Patch complexity: ---
Documentation contact: Documentation submission:
Text to go in the release notes:
Version(s) released in:
Attachments: Bug 8886 - Uninitialized variable triggers error log entry in z3950_search.pl
z3950_search reducing uninitialized variables error log entries
z3950_search reducing uninitialized variables error log entries (3.8.x/3.6.x)

Description Mark Tompsett 2012-10-06 13:06:52 UTC
If $frameworkcode and $op are not defined, it generates an error log entry.

I confirmed that "|| q{}" was safe for $op, as there was only one place it was used.

It is also safe for $frameworkcode, because it is impossible to enter nothing as a frameworkcode in biblio_framework. I checked back to biblio_framework because of the loop that does the "eq $frameworkcode" which floods the error log. The hashes are ultimately built from a select statement.

This bug was discovered in 3.8.5, it applies to 3.6.x, 3.8.x, and master.

Test Plan
---------
1) Login to staff client
2) Acquisitions
3) Search for a vendor (should exist)
4) enter a new basket (or existing basket)
5) "From an external source"
6) check error log file. There will be several errors like:

[Sat Oct 06 20:09:37 2012] [error] [client 192.168.100.2] [Sat Oct  6 20:09:37 2012] z3950_search.pl: Use of uninitialized value $frameworkcode in string eq at /usr/share/koha/intranet/cgi-bin/acqui/z3950_search.pl line 100.

And one like:
[Sat Oct 06 20:09:37 2012] [error] [client 192.168.100.2] [Sat Oct  6 20:09:37 2012] z3950_search.pl: Use of uninitialized value $op in string ne at /usr/share/koha/intranet/cgi-bin/acqui/z3950_search.pl line 116.

7) apply patch
8) repeat steps, and those errors will not be generated.

Patch(es) to follow.
Comment 1 Mark Tompsett 2012-10-06 13:36:44 UTC Comment hidden (obsolete)
Comment 2 Mark Tompsett 2012-11-01 09:10:39 UTC
Hmmm... seems that some older patch has been applied... Corrected patch(es) to follow.
Comment 3 Mark Tompsett 2012-11-01 09:55:43 UTC
Created attachment 13169 [details] [review]
z3950_search reducing uninitialized variables error log entries

This one is for master.
Comment 4 Mark Tompsett 2012-11-01 09:56:42 UTC
Created attachment 13170 [details] [review]
z3950_search reducing uninitialized variables error log entries (3.8.x/3.6.x)

This applies for 3.8.x and 3.6.x versions.
Comment 5 Owen Leonard 2012-11-08 17:47:18 UTC
I get the same errors before and after the patch (testing the one for master).
Comment 6 Mark Tompsett 2013-04-11 02:35:44 UTC
In attempting to generate this issue again in master (3.11.x), some patch in the process of bug 9105 "fixed" the uninitialized variables. Though, "|| q{}" is friendlier to perl critic than "||''".

*** This bug has been marked as a duplicate of bug 9105 ***