Bug 8176

Summary: $sqlwhere is undefined in C4::Serials in GetSubscriptions
Product: Koha Reporter: Mark Tompsett <mtompset>
Component: SerialsAssignee: Colin Campbell <colin.campbell>
Status: CLOSED FIXED QA Contact:
Severity: normal    
Priority: P5 - low CC: chris, jonathan.druart, koha.sekjal, mtompset, paul.poulain
Version: 3.8   
Hardware: All   
OS: All   
Change sponsored?: --- Patch complexity: ---
Documentation contact: Documentation submission:
Text to go in the release notes:
Version(s) released in:
Attachments: Proposed patch
Bug 8176 [SIGNED-OFF] Assign an intial value to $sqlwhere
Bug 8176 [SIGNED-OFF] Assign an intial value to $sqlwhere

Description Mark Tompsett 2012-06-01 04:12:36 UTC
This is similar to 7105, but 7105 forgot to add one more line.

Add this    -->    $sqlwhere = ( $sqlwhere ? $sqlwhere : "" );
Before this -->    $sql .= "$sqlwhere ORDER BY title";

Around line 606 in C4::Serials.
I'm looking at 3.6.3

This is what triggered my search:
[Fri Jun 01 07:06:39 2012] [error] [client 192.168.100.2] [Fri Jun  1 07:06:39 2
012] serials-home.pl: Use of uninitialized value $sqlwhere in concatenation (.)
or string at /usr/share/koha/lib/C4/Serials.pm line 606.
Comment 1 Colin Campbell 2012-06-01 07:24:43 UTC Comment hidden (obsolete)
Comment 2 Colin Campbell 2012-06-01 07:28:11 UTC
Changed version to unspecified patch should apply to 3.6  and current development HEAD
Comment 3 Jonathan Druart 2012-06-01 09:32:57 UTC
Created attachment 9872 [details] [review]
Bug 8176 [SIGNED-OFF] Assign an intial value to $sqlwhere

warnings in log because of undefined value in
string concatenation
variable should be initialized to empty string rather
than left undefined

Signed-off-by: Jonathan Druart <jonathan.druart@biblibre.com>
Removes a warning in logs
Comment 4 Ian Walls 2012-06-04 15:25:23 UTC
Just gives $sqlwhere a default defined value of empty string.  Marking Passed QA.
Comment 5 Paul Poulain 2012-06-05 13:31:52 UTC
Colin, a question before pushing the patch : why =q{} and not ='' ?
Comment 6 Jonathan Druart 2012-06-05 14:18:25 UTC
Paul,
q{} is preferable according to the PBP.

http://cpan.uwinnipeg.ca/htdocs/Perl-Critic/Perl/Critic/Policy/ValuesAndExpressions/ProhibitEmptyQuotes.pm.html

and

http://cheat.errtheblog.com/s/perl_best/1
#34 (Don’t use "" or '' for an empty string.)
Comment 7 Chris Cormack 2012-06-06 05:37:05 UTC
Pushed to 3.8.x, will be in 3.8.2
Comment 8 Kyle M Hall 2012-06-09 10:28:20 UTC Comment hidden (obsolete)