From 05423a313be67eef2cef012e4fe67a6de28214c9 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. Signed-off-by: Jonathan Druart Signed-off-by: Lucas Gass --- Koha/FrameworkPlugin.pm | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/Koha/FrameworkPlugin.pm b/Koha/FrameworkPlugin.pm index 3655a5d3b0..844957bf0d 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};