[Koha-bugs] [Bug 4064] Uninitialized variable errors in opac-search.pl
bugzilla-daemon at bugs.koha-community.org
bugzilla-daemon at bugs.koha-community.org
Sat Jun 30 07:52:40 CEST 2012
http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=4064
--- Comment #1 from M. Tompsett <mtompset at hotmail.com> ---
Created attachment 10572
-->
http://bugs.koha-community.org/bugzilla3/attachment.cgi?id=10572&action=edit
Optimized two if statements, but otherwise fixed already in master.
I was hunting through opac-search.pl and only found two references to
$params->{'offset'} other than the initialization line that oleonard pointed
out.
616: if (($params->{'offset'}||'') eq '') {
594: if (($params->{'offset'}||'') eq '') {
If the parameter is undefined, the two lines above will be true.
If the parameter is an empty string, the two lines above will be true.
If the parameter is 0 or "0", the two lines above will be true.
If the parameter is a non-zero value or an otherwise non-empty string, the two
lines above will be false.
It would seem to me that the above code on lines 594 and 616 in master is
sufficient.
Additionally, oleonard mentioned $borrowernumber.
592: if (!$borrowernumber || $borrowernumber eq '') {
This is the only line that resembles what oleonard referred to.
It would seem to me that the above code on line 592 in master is sufficient.
The initialization of $offset is now on line 400 in master:
my $offset = $params->{'offset'} || 0;
This implies that the parameter is expected to be numeric, not a string.
I think oleonard's observation that there is a $offset variable is useful to
note as everywhere else in opac-search.pl uses the $offset variable.
Based on the initialization line above:
If the parameter is undefined, $offset is 0.
If the parameter is an empty string, $offset is 0.
If the parameter is 0 or "0", $offset is 0.
If the parameter is a non-zero value or an otherwise non-empty string, $offset
is that value or string.
This means that lines 616 and 594 could be optimized to:
616: if (!$offset) {
594: if (!$offset) {
Lines 592 and 594 correspond to the two lines oleonard mentions. This means I
believe the bug is fixed already. I am changing the status to Needs Signoff, as
this is not NEW. I'm attaching a patch accordingly, but feel free to reject it
and just close this.
--
You are receiving this mail because:
You are the QA Contact for the bug.
You are watching all bug changes.
More information about the Koha-bugs
mailing list