From 3944f20beb6850f576cb9f68cd5ee9ac4493efb5 Mon Sep 17 00:00:00 2001 From: Marcel de Rooy Date: Wed, 18 Mar 2020 13:54:52 +0000 Subject: [PATCH] Bug 24892: Resolve uninitialized warns from opac-memberentry Especially line 500 (current master). Use of uninitialized value $new_data{"sort2"} in string eq at /usr/share/koha/opac/opac-memberentry.pl line 500. Use of uninitialized value in string eq at /usr/share/koha/opac/opac-memberentry.pl line 500. Simple fix, not completely trivial due to adding xor ;) Test plan: Do not apply, update from opac memberentry. Check warns in log. Apply patch, update again. Less warns? Signed-off-by: Marcel de Rooy Signed-off-by: Owen Leonard Signed-off-by: Kyle M Hall Signed-off-by: Martin Renvoize --- opac/opac-memberentry.pl | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/opac/opac-memberentry.pl b/opac/opac-memberentry.pl index 391a78f8e0..48054f3ca2 100755 --- a/opac/opac-memberentry.pl +++ b/opac/opac-memberentry.pl @@ -497,7 +497,8 @@ sub DelUnchangedFields { foreach my $key ( keys %new_data ) { - if ( ($current_data->{$key} eq $new_data{$key}) || $hidden_fields->{$key} ) { + next if defined($new_data{$key}) xor defined($current_data->{$key}); + if ( !defined($new_data{$key}) || $current_data->{$key} eq $new_data{$key} || $hidden_fields->{$key} ) { delete $new_data{$key}; } } -- 2.39.5