From 063002333d8877b114f6b03124adf53b004f08bd Mon Sep 17 00:00:00 2001 From: Michael Hafen Date: Fri, 7 May 2021 14:13:49 -0600 Subject: [PATCH] Bug 28303 - Fix plugins system with multiple pluginsdir settings C4/Templates::badtemplatecheck mucks with the config('pluginsdir') array ref. This makes sure it operates on a copy of the array. Signed-off-by: David Nind --- C4/Templates.pm | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/C4/Templates.pm b/C4/Templates.pm index f6fefaa6fa..d41c9b534e 100644 --- a/C4/Templates.pm +++ b/C4/Templates.pm @@ -186,9 +186,14 @@ sub badtemplatecheck { # This also includes two dots Koha::Exceptions::NoPermission->throw( 'bad template path' ); } else { - # Check allowed dirs + # Check allowed dirs - make sure we operate on a copy of the config my $dirs = C4::Context->config("pluginsdir"); - $dirs = [ $dirs ] if !ref($dirs); + if ( !ref($dirs) ) { + $dirs = [ $dirs ]; + } + else { + $dirs = [ @$dirs ]; + } unshift @$dirs, C4::Context->config('opachtdocs'), C4::Context->config('intrahtdocs'); my $found = 0; foreach my $dir ( @$dirs ) { -- 2.20.1