From 3c7172f7f5a0f6f9a26469c521586d4acb3426d5 Mon Sep 17 00:00:00 2001 From: Galen Charlton Date: Mon, 16 Jun 2008 08:15:03 -0500 Subject: [PATCH] bug 2247: don't crash linking bib heading with invalid subfield Prevent following crash when linking a bib heading to an authority record if the bib heading has a subfield whose code is ')' or any other regular expression metacharacter: Unmatched ) in regex; marked by <-- HERE in m/) <-- HERE / at /home/koha-pro/kohaclone/C4/Heading/MARC21.pm line 186. Signed-off-by: Joshua Ferraro --- C4/Heading/MARC21.pm | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/C4/Heading/MARC21.pm b/C4/Heading/MARC21.pm index 66c2904c24..4b328282af 100644 --- a/C4/Heading/MARC21.pm +++ b/C4/Heading/MARC21.pm @@ -182,8 +182,9 @@ sub _get_search_heading { my $first = 1; for (my $i = 0; $i <= $#subfields; $i++) { my $code = $subfields[$i]->[0]; + my $code_re = quotemeta $code; my $value = $subfields[$i]->[1]; - next unless $subfields =~ qr/$code/; + next unless $subfields =~ qr/$code_re/; if ($first) { $first = 0; $heading = $value; -- 2.39.5