Bug 8714 - Poorly ordered and triggers warning in marctagstructure.pl origin/new/bug_8714
authorMark Tompsett <mtompset@hotmail.com>
Mon, 3 Sep 2012 04:27:58 +0000 (12:27 +0800)
committerPaul Poulain <paul.poulain@biblibre.com>
Mon, 17 Sep 2012 16:25:28 +0000 (18:25 +0200)
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>
Signed-off-by: Paul Poulain <paul.poulain@biblibre.com>
admin/marctagstructure.pl

index d42e345..fd8d7c2 100755 (executable)
@@ -267,7 +267,7 @@ if ($op eq 'add_form') {
                        $row_data{delete}        = "$script_name?op=delete_confirm&amp;searchfield="      .$results[$i]->{'mts_tagfield'}."&amp;frameworkcode=".$frameworkcode;
                        $j=$i;
                        my @internal_loop = ();
-                       while ( ( $results[$i]->{'tagfield'} == $results[$j]->{'tagfield'} ) and ( $j < $cnt ) ) {
+                       while ( ( $j < $cnt ) and ( $results[$i]->{'tagfield'} == $results[$j]->{'tagfield'} ) ) {
                                my %subfield_data;
                                $subfield_data{tagsubfield}      = $results[$j]->{'tagsubfield'};
                                $subfield_data{liblibrarian}     = $results[$j]->{'liblibrarian'};