From 78b0ed6f92074873643eda5fae303179f0a8c8ff Mon Sep 17 00:00:00 2001 From: Roman Dolny Date: Sun, 25 Jan 2026 13:40:10 +0000 Subject: [PATCH] Bug 41706: "Use of uninitialized value..." warning in C4/Record.pm The warning: [WARN] Use of uninitialized value $2 in split at /kohadevbox/koha/C4/Record.pm line 924. appears in the plack-opac-error.log file. It happens during the preparation of data for the "Cite" feature in OPAC for some of author's fields. To test: ======== 1. Observe plack-opac-error.log. 2. In OPAC go to record with one word author like Aristophanes, Aristotle or Xenophon (biblionumbers: 64, 176, 254). 3. Show it in any of "detail" view (Normal, MARC, ISBD). 4. Warning appears in plack-opac-error.log. 5. Apply the patch; restart_all. 6. Repeat 2-3. Warning doesn't appear. Sponsored-by: Ignatianum University in Cracow --- C4/Record.pm | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/C4/Record.pm b/C4/Record.pm index febb1228ae..10561370fa 100644 --- a/C4/Record.pm +++ b/C4/Record.pm @@ -919,9 +919,11 @@ sub marc2cites { $author = $field->subfield("a"); } if ( $author =~ /([^,]+),?(.*)/ ) { + my $surname = $1; + my $forenames = $2; my %a; - ( $a{'surname'} = $1 ) =~ s/$re_clean//g; - $a{'forenames'} = [ map { my $t = $_; $t =~ s/$re_clean//g; $t } split ' ', $2 ]; + ( $a{'surname'} = $surname ) =~ s/$re_clean//g; + $a{'forenames'} = [ map { my $t = $_; $t =~ s/$re_clean//g; $t } split ' ', $forenames ]; push( @authors, \%a ); } } -- 2.39.5