Go to file
Martin Renvoize ed0a3ebd82
Bug 42430: (QA follow-up) Fix nested plugin package corruption on reload
InstallPlugins forces every discovered plugin class to be deleted and
re-required from disk on every call, so plugin_methods reflects the
.pm file as it currently exists rather than whatever was already
loaded into a long-lived Plack worker. That deletion used
Symbol::delete_package, which clears the target package's whole
symbol table -- including any already-loaded packages nested under it
(e.g. a REST API controller a plugin bundles alongside itself, such as
Koha/Plugin/Foo/Controller.pm). Those nested classes keep their own
%INC entry, so they are never re-required afterwards and are left
permanently blanked out for the rest of the worker's life.

This was caught when running
`prove -r t/db_dependent/Koha/Plugins/ t/db_dependent/Koha/REST/Plugin/`
on top of the original patch. Tests fail several files that have nothing
to do with the bug being fixed (Biblio_and_Items_plugin_hooks.t,
Holds_hooks.t, TemplateIncludePathHook.t, REST/Plugin/PluginRoutes.t),
because Koha::Plugin::Test::Controller (a bundled test-fixture
controller living in t/lib/plugins/Koha/Plugin/Test/Controller.pm)
gets its symbol table wiped as collateral damage every time
Koha::Plugin::Test is reloaded.

_forget_plugin_class() replaces the delete_package call with the same
technique used by the CPAN module Class::Unload (not added as a
dependency here, just the technique): only clear the target class's
own symbols and reset its @ISA, explicitly leaving any nested package
entries in its symbol table alone. Module::Pluggable discovers bundled
nested classes as their own entries in the plugin list regardless, so
they still get reloaded correctly on their own turn.

I also annotate the no strict 'refs' block added by the previous commit
with a '## no critic' justification, as flagged by koha-qa.pl.

Test plan:
1. Confirm the bug exists without this patch:
   a) git checkout <previous commit> (drop this commit, keeping the
      first 3 commits of the bug applied)
   b) Inside KTD:
      prove -r t/db_dependent/Koha/Plugins/ t/db_dependent/Koha/REST/Plugin/
   c) Observe failing files unrelated to this bug's own tests:
      Biblio_and_Items_plugin_hooks.t, Holds_hooks.t,
      TemplateIncludePathHook.t and REST/Plugin/PluginRoutes.t.
2. Confirm the fix:
   a) Re-apply this commit
   b) Re-run the same command from 1(b) -- all tests now pass
3. Confirm the original bug this branch set out to fix is still fixed,
   both via the manual UI steps from the first commit's test plan
   (install Batch Permission Modifier Plugin 1.3.1, upload 1.4.1 over
   it via Tools > Plugins, confirm the renamed method takes effect
   without restarting Plack) and via:
   prove t/db_dependent/Koha/Plugins/Plugins.t
   (see the 'InstallPlugins() reloads stale symbol tables tests'
   subtest)
4. Confirm QA tooling is clean:
   koha-qa.pl -c 4
   => PASS for Koha/Plugins.pm and all touched test files, no critic
      or tidiness failures.

Signed-off-by: Martin Renvoize <martin.renvoize@openfifth.co.uk>
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2026-08-10 14:56:38 -06:00
.github/workflows Bug 40027: Use GitHub workflow to automatically close PRs opened on the Koha repo there 2025-10-06 09:15:26 -06:00
C4 Bug 42746: (QA follow-up) Sanitize agefield and substitution field at the sink too 2026-08-10 08:18:12 -06:00
Koha Bug 42430: (QA follow-up) Fix nested plugin package corruption on reload 2026-08-10 14:56:38 -06:00
acqui Bug 42571: Sending EDI order results in variable not available warnings 2026-08-10 14:56:33 -06:00
admin Bug 29587: Test mail option in SMTP servers 2026-06-15 18:12:16 -06:00
api Bug 41889: Update API to allow for null patron_id to be returned when listing checkouts 2026-07-13 16:10:36 -06:00
authorities Bug 21453: Copy data to the correct subfields when linking authorities with authorities 2026-04-23 09:24:58 -06:00
basket Bug 40163: Fix several http addresses in the code docs 2025-09-23 16:21:29 -06:00
bin Bug 40163: (follow-up) Fix wrong GNU links and update test 2025-09-24 09:25:04 -06:00
bookings Bug 40163: Fix several http addresses in the code docs 2025-09-23 16:21:29 -06:00
catalogue Bug 42637: Check if biblio exists before checking if it is fast add 2026-05-18 16:05:41 -06:00
cataloguing Bug 42764: Fix spelling errors across the codebase 2026-06-11 09:53:34 -06:00
circ Bug 41940: Remove uninitialized value warnings in circulation.pl 2026-05-20 09:04:58 -06:00
clubs Bug 40163: Fix several http addresses in the code docs 2025-09-23 16:21:29 -06:00
course_reserves Bug 40163: Fix several http addresses in the code docs 2025-09-23 16:21:29 -06:00
debian Bug 37762: VueJS ILL Module 2026-05-08 12:25:38 -06:00
docs Bug 42726: Add 26.11 release team 2026-06-08 13:53:09 -06:00
erm Bug 40163: Fix several http addresses in the code docs 2025-09-23 16:21:29 -06:00
errors Bug 28146: Respect ReplytoDefault in error pages 2025-10-09 14:58:41 -06:00
etc Bug 37762: VueJS ILL Module 2026-05-08 12:25:38 -06:00
ill Bug 37762: Circulation: Hook to checkouts/checkins 2026-05-08 12:25:43 -06:00
installer Increment version for the 26.05.02 release 2026-08-10 08:18:15 -06:00
koha-tmpl Bug 42339: Make Record display customization cancel return to record display list 2026-08-10 14:56:36 -06:00
labels Bug 42764: Fix spelling errors across the codebase 2026-06-11 09:53:34 -06:00
lib Bug 41521: Silent perlcritic warnings 2026-03-24 09:55:54 +01:00
members Bug 41946: Allow superlibrarians to set protected flag on patron creation 2026-08-10 14:56:12 -06:00
misc Update release notes for the 26.05.02 release 2026-08-10 08:18:16 -06:00
offline_circ Bug 40163: Fix several http addresses in the code docs 2025-09-23 16:21:29 -06:00
opac Bug 43019: Fix branch comparison 2026-08-10 08:18:04 -06:00
patron_lists Bug 32176: Remove duplicated code to select patron from autocomplete 2025-10-31 15:26:25 -06:00
patroncards Bug 42747: (QA follow-up) Parameterize query, dedupe, and log rejections 2026-08-10 08:18:10 -06:00
plugins Bug 25952: Skip invalid repositories when searching for plugins 2025-11-21 08:41:52 -07:00
pos Bug 41705: Use PRG pattern for POS receipt printing to avoid popup blockers 2026-06-04 15:09:06 -06:00
preservation Bug 35267: Apply preferences to preview and mailing 2026-04-17 09:18:06 -06:00
recalls Bug 40163: Fix several http addresses in the code docs 2025-09-23 16:21:29 -06:00
reports Bug 42803: Only perform the lookups when !$filter is true 2026-07-09 13:06:41 -06:00
reserve Bug 37762: Circulation: Hook to holds 2026-05-08 12:25:43 -06:00
reviews Bug 40163: Fix several http addresses in the code docs 2025-09-23 16:21:29 -06:00
rotating_collections Bug 40163: Fix several http addresses in the code docs 2025-09-23 16:21:29 -06:00
serials Bug 42078: Allow vendor ID searches on serial subscription vendor search page 2026-07-07 16:07:52 -06:00
services Bug 40163: Fix several http addresses in the code docs 2025-09-23 16:21:29 -06:00
sip2 Bug 37893: Fix http links 2025-11-18 11:21:20 -07:00
skel
…
suggestion Bug 42757: Use default suggestor or fallback to librarian 2026-06-08 13:53:26 -06:00
svc Bug 42084: (QA follow-up) Simplify 2026-06-08 13:53:12 -06:00
t Bug 42430: (QA follow-up) Fix nested plugin package corruption on reload 2026-08-10 14:56:38 -06:00
tags Bug 42254: (QA follow-up) Remove unused var, fixing a FIXME 2026-04-28 15:48:24 -06:00
tools Bug 42746: (QA follow-up) Sanitize agefield and substitution field at the sink too 2026-08-10 08:18:12 -06:00
virtualshelves Bug 40916: Fix another occurance 2025-10-06 09:15:22 -06:00
xt Bug 42764: Include filename in codespell test output 2026-06-11 09:53:36 -06:00
.codespell-ignore Bug 42764: Fix false positives caused by POD letter-code formatting 2026-06-11 09:53:35 -06:00
.editorconfig
…
.git-blame-ignore-revs
…
.gitignore Bug 26355: Add a Vue island for the self-renewal modal 2026-05-01 09:30:00 -06:00
.htaccess
…
.mailmap Bug 40041: (follow-up) Fix periods and add Robert Fox 2025-12-05 09:29:04 -07:00
.nvmrc Bug 42353: Store the node version in .nvmrc 2026-04-15 09:14:53 -06:00
.perlcriticrc
…
.perltidyrc
…
.prettierrc.js
…
.proverc.dist
…
.stylelintrc.json
…
INSTALL
…
Koha.pm Increment version for the 26.05.02 release 2026-08-10 08:18:15 -06:00
LICENSE Bug 40163: Fix several http addresses in the code docs 2025-09-23 16:21:29 -06:00
MANIFEST.SKIP
…
Makefile.PL Bug 41076: Adjust our perl tidiness for v20250105 2026-02-05 09:03:51 -07:00
README
…
README.md Bug 40163: Fix several http addresses in the code docs 2025-09-23 16:21:29 -06:00
README.robots
…
SECURITY.md Bug 40527: Initial draft of SECURITY.md 2025-10-09 14:58:41 -06:00
about.pl Bug 42453: Remove warning 2026-07-13 16:10:30 -06:00
app.psgi Bug 38365: Integrate CSP middleware into Plack apps 2026-03-16 11:57:12 +01:00
build-resources.PL Bug 40163: (follow-up) Fix wrong GNU links and update test 2025-09-24 09:25:04 -06:00
changelanguage.pl Bug 40163: Fix several http addresses in the code docs 2025-09-23 16:21:29 -06:00
cpanfile Bug 42317: Update minimum version for MARC::File::XML 2026-05-20 09:04:55 -06:00
cypress.config.ts Bug 41362: Allow Cypress tests to use KOHA_USER and KOHA_PASS as override 2026-01-06 07:45:35 -07:00
eslint.config.mjs
…
fix-perl-path.PL Bug 40163: (follow-up) Fix wrong GNU links and update test 2025-09-24 09:25:04 -06:00
gulpfile.js Bug 42356: Silence Sass if-function deprecation warning 2026-04-17 09:18:15 -06:00
help.pl Bug 40163: Fix several http addresses in the code docs 2025-09-23 16:21:29 -06:00
kohaversion.pl
…
mainpage.pl Bug 40163: Fix several http addresses in the code docs 2025-09-23 16:21:29 -06:00
package.json Bug 34973: Upgrade Font Awesome in the OPAC to 7.2 2026-06-04 15:09:08 -06:00
rewrite-config.PL Bug 40163: (follow-up) Fix wrong GNU links and update test 2025-09-24 09:25:04 -06:00
rspack.config.js Bug 37762: VueJS ILL Module 2026-05-08 12:25:38 -06:00
tsconfig.json
…
yarn.lock Bug 34973: Update yarn.lock 2026-06-09 15:42:19 -06:00

README.md

Koha is a free software integrated library system (ILS).

Koha is distributed under the GNU GPL version 3 or later.

Note: Koha does not accept pull requests from git hosting sites.

Note: This project has its own bug tracker, to report a bug or submit a patch visit https://bugs.koha-community.org.

For guidelines on submitting patches for Koha please visit https://wiki.koha-community.org/wiki/SubmitingAPatch

The developers handbook can be found at https://wiki.koha-community.org/wiki/Developer_handbook

https://koha-community.org/

Koha Logo