Bug 33205 - (Bug 28268 follow-up) Method call $row->authid inside quotes - produces meaningless warning
Summary: (Bug 28268 follow-up) Method call $row->authid inside quotes - produces meani...
Status: Pushed to main
Alias: None
Product: Koha
Classification: Unclassified
Component: Searching - Elasticsearch (show other bugs)
Version: Main
Hardware: All All
: P5 - low minor (vote)
Assignee: Janusz Kaczmarek
QA Contact:
URL:
Keywords:
Depends on: 28268
Blocks:
  Show dependency treegraph
 
Reported: 2023-03-11 10:37 UTC by Janusz Kaczmarek
Modified: 2024-04-12 12:06 UTC (History)
2 users (show)

See Also:
Change sponsored?: ---
Patch complexity: Trivial patch
Documentation contact:
Documentation submission:
Text to go in the release notes:
Version(s) released in:
24.05.00


Attachments
Bug 33205 (bug 28268 follow-up) Method call $row->authid inside quotes - produces meaningless warning (1.80 KB, patch)
2024-04-11 14:08 UTC, Janusz Kaczmarek
Details | Diff | Splinter Review
Bug 33205: (bug 28268 follow-up) Method call $row->authid inside quotes - produces meaningless warning (1.86 KB, patch)
2024-04-12 11:16 UTC, Nick Clemens (kidclamp)
Details | Diff | Splinter Review

Note You need to log in before you can comment on or make changes to this bug.
Description Janusz Kaczmarek 2023-03-11 10:37:35 UTC
Bug 28268, in Koha::MetadataRecord::Authority::get_all_authorities_iterator, introduced a warning:

warn "Something went wrong reading record for authority $row->authid: $@\n";

But a method cannot be called from within quotes in Perl - extrapolation does not work for functions/methods.  So, if something really goes wrong, this line of code produces a warning like:

Something went wrong reading record for authority Koha::Schema::Result::AuthHeader=HASH(0x55cf7e0d0958)->authid: Empty String at /usr/share/perl5/MARC/File/XML.pm line 450.

which is not very informative -- authid is missing.

Proposal: $row->authid should be placed outside of the quotes.
Comment 1 Janusz Kaczmarek 2024-04-11 14:08:25 UTC
Created attachment 164718 [details] [review]
Bug 33205 (bug 28268 follow-up) Method call $row->authid inside quotes - produces meaningless warning

Bug 28268, in
Koha::MetadataRecord::Authority::get_all_authorities_iterator,
introduced a warning:

warn "Something went wrong reading record for authority $row->authid: $@\n";

But a method cannot be called from within quotes in Perl - extrapolation
does not work for functions/methods.  So, if something really goes
wrong, this line of code produces a warning like:

Something went wrong reading record for authority
Koha::Schema::Result::AuthHeader=HASH(0x55cf7e0d0958)->authid: Empty
String at /usr/share/perl5/MARC/File/XML.pm line 450.

which is not very informative -- authid is missing.

Test plan
=========
Hard to reproduce.  This problem occurs only in rare cases of some weird problem
in stores authority data or if a auth record had been deleted after a ES reindex
action has been initiated.  But the problem in the code and the fix seem obvious.
Comment 2 Nick Clemens (kidclamp) 2024-04-12 11:16:33 UTC
Created attachment 164826 [details] [review]
Bug 33205: (bug 28268 follow-up) Method call $row->authid inside quotes - produces meaningless warning

Bug 28268, in
Koha::MetadataRecord::Authority::get_all_authorities_iterator,
introduced a warning:

warn "Something went wrong reading record for authority $row->authid: $@\n";

But a method cannot be called from within quotes in Perl - extrapolation
does not work for functions/methods.  So, if something really goes
wrong, this line of code produces a warning like:

Something went wrong reading record for authority
Koha::Schema::Result::AuthHeader=HASH(0x55cf7e0d0958)->authid: Empty
String at /usr/share/perl5/MARC/File/XML.pm line 450.

which is not very informative -- authid is missing.

Test plan
=========
Hard to reproduce.  This problem occurs only in rare cases of some weird problem
in stores authority data or if a auth record had been deleted after a ES reindex
action has been initiated.  But the problem in the code and the fix seem obvious.

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Comment 3 Katrin Fischer 2024-04-12 12:06:18 UTC
Pushed for 24.05!

Well done everyone, thank you!