Bug 31535: Fix warning - uninitialized value in string ne (MARCdetail.pl)

Spotted at line 183 (older Koha version).

Test plan:
You need a NULL in the tab column of marc_subfield_structure. Hit this
page and check the logs.
This might convince you easier:
  my $tabloop=0; my $x; print "Empty string - True\n" if ( $x // q{} ) ne $tabloop;
  print "Zero - True\n" if ( $x // '0' ) ne $tabloop;
You should only see: Empty string - True proving that defaulting to '0'
would be a game changer.

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>

Signed-off-by: Joonas Kylmälä <joonas.kylmala@iki.fi>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
This commit is contained in:
Marcel de Rooy 2022-09-08 14:13:36 +00:00 committed by Tomas Cohen Arazi
parent 7d32333df3
commit 8ddec91211
No known key found for this signature in database
GPG Key ID: 0A272EA1B2F3C15F
1 changed files with 1 additions and 4 deletions

View File

@ -183,10 +183,7 @@ for ( my $tabloop = 0 ; $tabloop <= 10 ; $tabloop++ ) {
# loop through each subfield
for my $i ( 0 .. $#subf ) {
$subf[$i][0] = "@" unless defined $subf[$i][0];
next
if (
$tagslib->{ $fields[$x_i]->tag() }->{ $subf[$i][0] }->{tab}
ne $tabloop );
next if ( $tagslib->{ $fields[$x_i]->tag() }->{ $subf[$i][0] }->{tab} // q{} ) ne $tabloop; # Note: defaulting to '0' changes behavior!
next
if ( $tagslib->{ $fields[$x_i]->tag() }->{ $subf[$i][0] }
->{hidden} =~ /-7|-4|-3|-2|2|3|5|8/);