From 9fd8ed0b5a008297cc73c3cf6a534fdaf47f0510 Mon Sep 17 00:00:00 2001 From: Jacob O'Mara Date: Thu, 13 Nov 2025 10:12:06 +0000 Subject: [PATCH] Bug 39522: (follow up) Add defensive checking before instantiating plugins object Previously this could have caused issues if enable_plugins was disabled in koha-conf as we were not checking enabled status before instantiating an instance of the plugins object. --- Koha/FrameworkPlugin.pm | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/Koha/FrameworkPlugin.pm b/Koha/FrameworkPlugin.pm index 3655a5d3b06..844957bf0d1 100644 --- a/Koha/FrameworkPlugin.pm +++ b/Koha/FrameworkPlugin.pm @@ -213,8 +213,12 @@ sub _error { sub _load { my ($self) = @_; - # Try to find the class that can handle this plugin - my @plugins = Koha::Plugins->new()->get_valuebuilders_installed(); + # Try to find the class that can handle this plugin, but only if plugins are enabled + my @plugins; + if ( C4::Context->config("enable_plugins") ) { + my $plugins_obj = Koha::Plugins->new(); + @plugins = $plugins_obj->get_valuebuilders_installed() if $plugins_obj; + } foreach my $vb (@plugins) { my $plugin = $vb->{plugin}; -- 2.39.5