Bug 12573 - blinddetail-biblio-search uses wrong comparison operator
Summary: blinddetail-biblio-search uses wrong comparison operator
Status: CLOSED FIXED
Alias: None
Product: Koha
Classification: Unclassified
Component: MARC Authority data support (show other bugs)
Version: Main
Hardware: All All
: P5 - low trivial (vote)
Assignee: Colin Campbell
QA Contact: Testopia
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2014-07-14 15:26 UTC by Colin Campbell
Modified: 2015-06-04 23:33 UTC (History)
3 users (show)

See Also:
Change sponsored?: ---
Patch complexity: Trivial patch
Documentation contact:
Documentation submission:
Text to go in the release notes:
Version(s) released in:


Attachments
Proposed patch (1.35 KB, patch)
2014-07-14 15:38 UTC, Colin Campbell
Details | Diff | Splinter Review
Bug 12573: Use correct comparison for comparing strings (1.68 KB, patch)
2014-10-26 10:09 UTC, Frédéric Demians
Details | Diff | Splinter Review
[PASSED QA] Bug 12573: Use correct comparison for comparing strings (1.75 KB, patch)
2014-10-26 10:40 UTC, Katrin Fischer
Details | Diff | Splinter Review

Note You need to log in before you can comment on or make changes to this bug.
Description Colin Campbell 2014-07-14 15:26:18 UTC
The following message appears in the apache errorlog:
blinddetail-biblio-search.pl: Argument "\x{61}" isn't numeric in numeric eq (==) at /home/koha/kohaclone/authorities/blinddetail-biblio-search.pl line 89.

The program is comparing two strings with a numeric compare which can result in subtle bugs and error messages like the above even when working as expected
Comment 1 Colin Campbell 2014-07-14 15:38:45 UTC Comment hidden (obsolete)
Comment 2 Owen Leonard 2014-08-13 15:56:54 UTC
What is the test plan for this? Ways to trigger errors in the log which are eliminated by the patch?
Comment 3 Frédéric Demians 2014-10-26 10:09:28 UTC Comment hidden (obsolete)
Comment 4 Katrin Fischer 2014-10-26 10:40:03 UTC
Created attachment 32771 [details] [review]
[PASSED QA] Bug 12573: Use correct comparison for comparing strings

Perl issues a warning when you try to do a numeric comparison on
non numeric values. While in 99% of the caeses numeric and string
comparison behave similarly when they dont tracking down resulting
bugs is hard. Also we dont want to be logging errors for normal
operations. replace numeric == with eq
(also switched to non-interpolating quotes so we dont generate
a warning from static code checkers like perlcritic)

Signed-off-by: Frederic Demians <f.demians@tamil.fr>

I can get this warnings in log files. This patch make perfectly sense.
MARC subfield code should never be tested with Perl == operator, since
the code could be letter or a number. Perl eq operator do an implicit
string conversion for value which is a number, so it will work in any
case.

Signed-off-by: Katrin Fischer <Katrin.Fischer.83@web.de>
Comment 5 Tomás Cohen Arazi 2014-10-28 13:55:14 UTC
Patch pushed to master.

Good catch Colin!