Bug 8714

Summary: Poorly ordered and triggers warning in marctagstructure.pl
Product: Koha Reporter: Mark Tompsett <mtompset>
Component: System AdministrationAssignee: Mark Tompsett <mtompset>
Status: CLOSED FIXED QA Contact: Mason James <mtj>
Severity: trivial    
Priority: P5 - low CC: chris, gmcharlt, jonathan.druart, mtj, 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: Changed and statement to have boundary check first.
Bug 8714 - Poorly ordered and triggers warning in marctagstructure.pl

Description Mark Tompsett 2012-09-03 04:21:26 UTC
Found this in 3.6.3, but it applies to 3.6.x, 3.8.x, and master.
1) Log in to staff client
2) Click 'Koha administration'
3) Click 'MARC Bibliographic framework'
4) Choose a framework and click 'MARC structure'
5) Check 'Display only used Tags/Subfields'
6) Check koha error log
[Mon Sep 03 12:06:06 2012] [error] [client 192.168.100.2] [Mon Sep  3 12:06:06 2012] marctagstructure.pl: Use of uninitialized value in numeric eq (==) at /usr/share/koha/intranet/cgi-bin/admin/marctagstructure.pl line 284., referer: https://.../cgi-bin/koha/admin/marctagstructure.pl

284 is the bottom of the loop, but the top of the loop had "and boundary check" logic instead of "boundary check and" logic. Correcting this ordering problem fixed the bug.
Comment 1 Mark Tompsett 2012-09-03 04:35:11 UTC Comment hidden (obsolete)
Comment 2 Jonathan Druart 2012-09-04 09:02:18 UTC
Created attachment 11953 [details] [review]
Bug 8714 - Poorly ordered and triggers warning in marctagstructure.pl

An array boundary check was after a comparison using the array.
By changing the logic which had " and ( $j < $cnt)" to be at the
beginning "( $j < $cnt ) and ", the warning is no longer shown
in the error log.

Signed-off-by: Jonathan Druart <jonathan.druart@biblibre.com>
Comment 3 Mason James 2012-09-14 15:10:14 UTC
> Signed-off-by: Jonathan Druart <jonathan.druart@biblibre.com>

patch looks good, passing QA…

$ koha-qa.pl 

testing 1 commit(s) (applied to commit 0acebb8)
 * 146447b Bug 8714 - Poorly ordered and triggers warning in marctagstructur
      admin/marctagstructure.pl

* admin/marctagstructure.pl                                                OK
Comment 4 Paul Poulain 2012-09-17 16:27:00 UTC
Patch pushed to master
Comment 5 Chris Cormack 2012-09-18 10:38:42 UTC
Pushed to 3.8.x, will be in 3.8.5