[Bug 23384] New: Calling Koha::Article::Status::* without "use" in Patron.pm can cause breakage
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=23384 Bug ID: 23384 Summary: Calling Koha::Article::Status::* without "use" in Patron.pm can cause breakage Change sponsored?: --- Product: Koha Version: master Hardware: All OS: All Status: NEW Severity: normal Priority: P5 - low Component: Architecture, internals, and plumbing Assignee: koha-bugs@lists.koha-community.org Reporter: andrew.isherwood@ptfs-europe.com QA Contact: testopia@bugs.koha-community.org After spending a while digging into this, I can't explain why it's a problem, but I know that it is and I know how to fix it. During the development of Bug 23112 I encountered a weird problem whereby adding "use Illrequests" to C4/Circulation.pm causes the whole of the app to break with the following error: Bareword "Koha::ArticleRequest::Status::Pending" not allowed while "strict subs" in use at /home/koha-koha/kohaclone/Koha/Patron.pm line 811. Bareword "Koha::ArticleRequest::Status::Processing" not allowed while "strict subs" in use at /home/koha-koha/kohaclone/Koha/Patron.pm line 811. Compilation failed in require at /home/koha-koha/kohaclone/Koha/Illrequest.pm line 37. BEGIN failed--compilation aborted at /home/koha-koha/kohaclone/Koha/Illrequest.pm line 37. Compilation failed in require at /home/koha-koha/kohaclone/Koha/Illrequests.pm line 23. BEGIN failed--compilation aborted at /home/koha-koha/kohaclone/Koha/Illrequests.pm line 23. Compilation failed in require at /home/koha-koha/kohaclone/C4/Circulation.pm line 49. BEGIN failed--compilation aborted at /home/koha-koha/kohaclone/C4/Circulation.pm line 49. Compilation failed in require at /home/koha-koha/kohaclone/C4/Overdues.pm line 31. BEGIN failed--compilation aborted at /home/koha-koha/kohaclone/C4/Overdues.pm line 31. Compilation failed in require at /home/koha-koha/kohaclone/C4/Members.pm line 32. BEGIN failed--compilation aborted at /home/koha-koha/kohaclone/C4/Members.pm line 32. Compilation failed in require at /home/koha-koha/kohaclone/C4/Letters.pm line 30. BEGIN failed--compilation aborted at /home/koha-koha/kohaclone/C4/Letters.pm line 30. Compilation failed in require at /home/koha-koha/kohaclone/C4/Suggestions.pm line 29. BEGIN failed--compilation aborted at /home/koha-koha/kohaclone/C4/Suggestions.pm line 29. Compilation failed in require at /home/koha-koha/kohaclone/C4/Acquisition.pm line 25. BEGIN failed--compilation aborted at /home/koha-koha/kohaclone/C4/Acquisition.pm line 25. Compilation failed in require at /home/koha-koha/kohaclone/C4/Budgets.pm line 27. BEGIN failed--compilation aborted at /home/koha-koha/kohaclone/C4/Budgets.pm line 27. Compilation failed in require at /home/koha-koha/kohaclone/C4/Biblio.pm line 94. BEGIN failed--compilation aborted at /home/koha-koha/kohaclone/C4/Biblio.pm line 94. Compilation failed in require at /home/koha-koha/kohaclone/Koha/Biblio.pm line 27. BEGIN failed--compilation aborted at /home/koha-koha/kohaclone/Koha/Biblio.pm line 27. Compilation failed in require at /home/koha-koha/kohaclone/Koha/Biblios.pm line 26. BEGIN failed--compilation aborted at /home/koha-koha/kohaclone/Koha/Biblios.pm line 26. Compilation failed in require at /home/koha-koha/kohaclone/Koha/ArticleRequest.pm line 26. BEGIN failed--compilation aborted at /home/koha-koha/kohaclone/Koha/ArticleRequest.pm line 26. Compilation failed in require at /home/koha-koha/kohaclone/Koha/ArticleRequests.pm line 26. BEGIN failed--compilation aborted at /home/koha-koha/kohaclone/Koha/ArticleRequests.pm line 26. Compilation failed in require at /home/koha-koha/kohaclone/Koha/Patrons.pm line 28. BEGIN failed--compilation aborted at /home/koha-koha/kohaclone/Koha/Patrons.pm line 28. Compilation failed in require at /home/koha-koha/kohaclone/Koha/Item.pm line 33. BEGIN failed--compilation aborted at /home/koha-koha/kohaclone/Koha/Item.pm line 33. Compilation failed in require at /home/koha-koha/kohaclone/Koha/Items.pm line 26. BEGIN failed--compilation aborted at /home/koha-koha/kohaclone/Koha/Items.pm line 26. Compilation failed in require at /home/koha-koha/kohaclone/Koha/Checkout.pm line 28. BEGIN failed--compilation aborted at /home/koha-koha/kohaclone/Koha/Checkout.pm line 28. Compilation failed in require at /home/koha-koha/kohaclone/Koha/Checkouts.pm line 25. BEGIN failed--compilation aborted at /home/koha-koha/kohaclone/Koha/Checkouts.pm line 25. Compilation failed in require at /home/koha-koha/kohaclone/C4/Auth.pm line 37. BEGIN failed--compilation aborted at /home/koha-koha/kohaclone/C4/Auth.pm line 37. Compilation failed in require at /home/koha-koha/kohaclone/admin/preferences.pl line 23. BEGIN failed--compilation aborted at /home/koha-koha/kohaclone/admin/preferences.pl line 23. The reference to "preferences.pl" is a red herring and just reflects the page you're on at the time. The rest of the error is the same regardless of the page. Poking around, I've not been able to determine why the usage of Illrequest in Circulation.pm would cause Patron.pm to suddenly complain about Koha::ArticleRequest::Status::* calls being barewords. With Modern::Perl the strict subs pragma should catch that sort of stuff. So I've really got no idea what's going on. Anyway, the obvious fix is to add "use Koha::ArticleRequest::Status;" to Patron.pm, which is what the patch for this bug is going to do. I just wish I understood why it's a problem in the first place! -- You are receiving this mail because: You are watching all bug changes. You are the assignee for the bug.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=23384 Andrew Isherwood <andrew.isherwood@ptfs-europe.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|NEW |ASSIGNED Assignee|koha-bugs@lists.koha-commun |andrew.isherwood@ptfs-europ |ity.org |e.com -- You are receiving this mail because: You are watching all bug changes. You are the assignee for the bug.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=23384 Andrew Isherwood <andrew.isherwood@ptfs-europe.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Blocks| |23112 Referenced Bugs: https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=23112 [Bug 23112] Circulation of ILL items -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=23384 Andrew Isherwood <andrew.isherwood@ptfs-europe.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|ASSIGNED |Needs Signoff -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=23384 --- Comment #1 from Andrew Isherwood <andrew.isherwood@ptfs-europe.com> --- Created attachment 91811 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=91811&action=edit Bug 23384: Fix "strict subs" error This patch explicitly imports Koha::ArticleRequest::Status to avoid the strict subs error described in the bug. -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=23384 Michal Denar <black23@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |black23@gmail.com --- Comment #2 from Michal Denar <black23@gmail.com> --- Hi Andrew, can you provede test plan for this patch? Thank you. -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=23384 --- Comment #3 from Andrew Isherwood <andrew.isherwood@ptfs-europe.com> --- Test plan: - Edit "use Illrequests;" to the top of C4/Circulation.pm => TEST: Observe that no page in Koha will now load, and errors as described above - Add "use Koha::ArticleRequest::Status;" to Patron.pm => TEST: Observe that the problem is now fixed. - Scratch your head and wonder what the heck is going on -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=23384 Magnus Enger <magnus@libriotech.no> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |magnus@libriotech.no --- Comment #4 from Magnus Enger <magnus@libriotech.no> --- (In reply to Andrew Isherwood from comment #3)
- Edit "use Illrequests;" to the top of C4/Circulation.pm
You mean Koha::Illrequests, right? I still cant reproduce the problem. I did this: $ git diff diff --git a/C4/Circulation.pm b/C4/Circulation.pm index 014c018628..ae3e1bbc0e 100644 --- a/C4/Circulation.pm +++ b/C4/Circulation.pm @@ -24,6 +24,7 @@ use strict; use DateTime; use POSIX qw( floor ); use Koha::DateUtils; +use Koha::Illrequests; use C4::Context; use C4::Stats; use C4::Reserves; Did a restart_all in kohadevbox. But nothing obviously bad happens. I can still check out a book, for example. -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=23384 Andrew Isherwood <andrew.isherwood@ptfs-europe.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #91811|0 |1 is obsolete| | --- Comment #5 from Andrew Isherwood <andrew.isherwood@ptfs-europe.com> --- Created attachment 93912 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=93912&action=edit Bug 23384: Fix "strict subs" error This patch explicitly imports Koha::ArticleRequest::Status to avoid the strict subs error described in the bug. -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=23384 Owen Leonard <oleonard@myacpl.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Patch complexity|--- |Trivial patch Status|Needs Signoff |Signed Off -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=23384 Owen Leonard <oleonard@myacpl.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #93912|0 |1 is obsolete| | --- Comment #6 from Owen Leonard <oleonard@myacpl.org> --- Created attachment 98965 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=98965&action=edit Bug 23384: Fix "strict subs" error This patch explicitly imports Koha::ArticleRequest::Status to avoid the strict subs error described in the bug. Signed-off-by: Owen Leonard <oleonard@myacpl.org> -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=23384 --- Comment #7 from Owen Leonard <oleonard@myacpl.org> --- I signed this off because following this test plan is consistent with what the bug report says, with the assumption that the goal of the change is to allow at some future date the addition of "use Koha::Illrequests;" to Circulation.pm. 1. Add "use Koha::Illrequests;" to the top of C4/Circulation.pm 2. TEST: Nothing loads, the koha-plack-error log is stuck in an apparent loop 3. Add "use Koha::ArticleRequest::Status;" to Patron.pm 4. TEST: Pages are loading correctly again -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=23384 --- Comment #8 from Jonathan Druart <jonathan.druart@bugs.koha-community.org> --- Created attachment 99191 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=99191&action=edit [ALTERNATIVE-PATCH] Bug 23384: Fix use statement order for ArticleRequest::Status Koha::ArticleRequest is used by Koha::ArticleRequests so Koha::ArticleRequest::Status should not be needed in Koha::ArticleRequest. Also Koha::ArticleRequest::Status must be loaded before Koha::ArticleRequest -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=23384 Jonathan Druart <jonathan.druart@bugs.koha-community.org> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |jonathan.druart@bugs.koha-c | |ommunity.org --- Comment #9 from Jonathan Druart <jonathan.druart@bugs.koha-community.org> --- I think this alternative patch is the way to go. Koha::ArticleRequests was missing from Koha::Patron -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=23384 --- Comment #10 from Andrew Isherwood <andrew.isherwood@ptfs-europe.com> --- Sounds like you did a better job of getting to the bottom of the problem than I did Jonathan! At least your patch has some reasoning behind it, whereas mine was just "I don't know why this works, but it does" -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=23384 Jonathan Druart <jonathan.druart@bugs.koha-community.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Assignee|andrew.isherwood@ptfs-europ |jonathan.druart@bugs.koha-c |e.com |ommunity.org Status|Signed Off |Needs Signoff -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=23384 Jonathan Druart <jonathan.druart@bugs.koha-community.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #98965|0 |1 is obsolete| | -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=23384 Nick Clemens <nick@bywatersolutions.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|Needs Signoff |Signed Off -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=23384 --- Comment #11 from Nick Clemens <nick@bywatersolutions.com> --- Created attachment 100264 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=100264&action=edit Bug 23384: Fix use statement order for ArticleRequest::Status Koha::ArticleRequest is used by Koha::ArticleRequests so Koha::ArticleRequest::Status should not be needed in Koha::ArticleRequest. Also Koha::ArticleRequest::Status must be loaded before Koha::ArticleRequest Signed-off-by: Nick Clemens <nick@bywatersolutions.com> -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=23384 Nick Clemens <nick@bywatersolutions.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|Signed Off |Passed QA CC| |nick@bywatersolutions.com --- Comment #12 from Nick Clemens <nick@bywatersolutions.com> --- Tested with bug 23112, all works as expected, small change, passing QA -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=23384 Martin Renvoize <martin.renvoize@ptfs-europe.com> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |martin.renvoize@ptfs-europe | |.com Attachment #99191|0 |1 is obsolete| | -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=23384 Martin Renvoize <martin.renvoize@ptfs-europe.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|Passed QA |Pushed to master Version(s)| |20.05.00 released in| | -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=23384 --- Comment #13 from Martin Renvoize <martin.renvoize@ptfs-europe.com> --- Nice work everyone! Pushed to master for 20.05 -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=23384 Joy Nelson <joy@bywatersolutions.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Version(s)|20.05.00 |20.05.00, 19.11.05 released in| | Status|Pushed to master |Pushed to stable CC| |joy@bywatersolutions.com --- Comment #14 from Joy Nelson <joy@bywatersolutions.com> --- Backported to 19.11.x for 19.11.05 -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=23384 Lucas Gass <lucas@bywatersolutions.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Version(s)|20.05.00, 19.11.05 |20.05.00, 19.11.05, released in| |19.05.10 CC| |lucas@bywatersolutions.com Status|Pushed to stable |Pushed to oldstable --- Comment #15 from Lucas Gass <lucas@bywatersolutions.com> --- backported to 19.05.x for 19.05.10 -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=23384 Hayley Mapley <hayleymapley@catalyst.net.nz> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |hayleymapley@catalyst.net.n | |z --- Comment #16 from Hayley Mapley <hayleymapley@catalyst.net.nz> --- Unable to replicate this issue on 18.11.x, not backporting for now - if you can replicate on 18.11.x let me know and I will apply it -- You are receiving this mail because: You are watching all bug changes.
participants (1)
-
bugzilla-daemon@bugs.koha-community.org