Bug 26138

Summary: Errors if enable_plugins is zero
Product: Koha Reporter: Aleisha Amohia <aleisha>
Component: Plugin architectureAssignee: Jonathan Druart <jonathan.druart>
Status: CLOSED FIXED QA Contact: Testopia <testopia>
Severity: blocker    
Priority: P5 - low CC: jonathan.druart, lucas, martin.renvoize
Version: Main   
Hardware: All   
OS: All   
Change sponsored?: --- Patch complexity: ---
Documentation contact: Documentation submission:
Text to go in the release notes:
Version(s) released in:
20.11.00
Bug Depends on: 26063    
Bug Blocks:    
Attachments: Bug 26138: Make Koha::Plugins->call return consistent value
Bug 26138: Make Koha::Plugins->call return consistent value
Bug 26138: Make Koha::Plugins->call return consistent value

Description Aleisha Amohia 2020-08-04 22:01:18 UTC
Bug 26063 introduced a new way of checking plugins with Koha::Plugins->call(), except there are now errors all over the OPAC if enable_plugins is zero in the config.

Trying to submit a simple search throws this error: Can't use string ("0") as a HASH ref while "strict refs" in use at /home/vagrant/kohaclone/opac/opac-search.pl line 661

This is a bad blocker assuming every instance uses plugins.
Comment 1 Jonathan Druart 2020-08-05 07:33:29 UTC
Created attachment 107819 [details] [review]
Bug 26138: Make Koha::Plugins->call return consistent value

It must return an empty array in case the enable_plugins config flag is
disabled

Test plan:
Turn the config off in koha-conf
Start a search at the OPAC
Without this patch you got:
  Can't use string ("0") as a HASH ref while "strict refs" in use at /home/vagrant/kohaclone/opac/opac-search.pl line 661
With this patch applied you see the search result
Comment 2 Alex Buckley 2020-08-05 10:29:03 UTC
Created attachment 107825 [details] [review]
Bug 26138: Make Koha::Plugins->call return consistent value

It must return an empty array in case the enable_plugins config flag is
disabled

Test plan:
Turn the config off in koha-conf
Start a search at the OPAC
Without this patch you got:
  Can't use string ("0") as a HASH ref while "strict refs" in use at /home/vagrant/kohaclone/opac/opac-search.pl line 661
With this patch applied you see the search result

Followed test plan - works as described.

Signed-off-by: Alex Buckley <alexbuckley@catalyst.net.nz>
Comment 3 Martin Renvoize 2020-08-05 11:21:04 UTC
Created attachment 107830 [details] [review]
Bug 26138: Make Koha::Plugins->call return consistent value

It must return an empty array in case the enable_plugins config flag is
disabled

Test plan:
Turn the config off in koha-conf
Start a search at the OPAC
Without this patch you got:
  Can't use string ("0") as a HASH ref while "strict refs" in use at /home/vagrant/kohaclone/opac/opac-search.pl line 661
With this patch applied you see the search result

Followed test plan - works as described.

Signed-off-by: Alex Buckley <alexbuckley@catalyst.net.nz>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Comment 4 Martin Renvoize 2020-08-05 11:21:35 UTC
Clear and consistent fix works as described. Passes QA scripts and no regressions found.

Passing QA
Comment 5 Jonathan Druart 2020-08-05 15:37:04 UTC
Pushed to master for 20.11, thanks to everybody involved!
Comment 6 Lucas Gass 2020-08-13 17:56:58 UTC
doesn't apply clean to 20.05.x, will need a rebase