From f117fa6f97a10008071e029d4fdc7a516f22200f 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 Signed-off-by: Joy Nelson (cherry picked from commit 44d91396128a38a29b21f643f2e6439383a03e5c) Signed-off-by: Lucas Gass --- 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 a8003103d3..c4f7d9ebb1 100755 --- a/opac/opac-memberentry.pl +++ b/opac/opac-memberentry.pl @@ -493,7 +493,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