Bug 32462 - Warning in Koha::Item->columns_to_str
Summary: Warning in Koha::Item->columns_to_str
Status: NEW
Alias: None
Product: Koha
Classification: Unclassified
Component: Architecture, internals, and plumbing (show other bugs)
Version: Main
Hardware: All All
: P5 - low minor
Assignee: Bugs List
QA Contact: Testopia
URL:
Keywords:
Depends on:
Blocks: 25790
  Show dependency treegraph
 
Reported: 2022-12-13 19:52 UTC by Fridolin Somers
Modified: 2022-12-14 09:30 UTC (History)
1 user (show)

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


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Fridolin Somers 2022-12-13 19:52:14 UTC
I see this warning :
[WARN] Use of uninitialized value in join or string at /home/koha/src/Koha/Item.pm line 1041.
I think it is in Koha::Item->columns_to_str() when more_subfields_xml contains an empty subfield :

<record>
  <leader>         a              </leader>
  <datafield tag="999" ind1=" " ind2=" ">
    <subfield code="q"></subfield>
  </datafield>
</record>
Comment 1 Jonathan Druart 2022-12-14 09:30:27 UTC
This change could work.

diff --git a/Koha/Item.pm b/Koha/Item.pm
index e508e7eb55c..f431f739b4f 100644
--- a/Koha/Item.pm
+++ b/Koha/Item.pm
@@ -1107,7 +1107,7 @@ sub columns_to_str {
         }
 
         while ( my ( $k, $v ) = each %$more_values ) {
-            $values->{$k} = join ' | ', @$v;
+            $values->{$k} = join ' | ', map { defined $_ ? $_ : q{} } @$v;
         }
     }