Bug 30638 - Odd number of elements in anonymous hash at C4/Letters.pm line 827
Summary: Odd number of elements in anonymous hash at C4/Letters.pm line 827
Status: CLOSED FIXED
Alias: None
Product: Koha
Classification: Unclassified
Component: Architecture, internals, and plumbing (show other bugs)
Version: Main
Hardware: All All
: P5 - low minor (vote)
Assignee: Marcel de Rooy
QA Contact: Testopia
URL:
Keywords:
Depends on:
Blocks: 25790
  Show dependency treegraph
 
Reported: 2022-04-28 09:58 UTC by Marcel de Rooy
Modified: 2023-12-28 20:43 UTC (History)
0 users

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


Attachments
Bug 30638: Resolve odd number in hash warn in Letters (1.27 KB, patch)
2022-04-28 10:07 UTC, Marcel de Rooy
Details | Diff | Splinter Review
Bug 30638: Resolve odd number in hash warn in Letters (1.29 KB, patch)
2022-05-06 09:25 UTC, Katrin Fischer
Details | Diff | Splinter Review

Note You need to log in before you can comment on or make changes to this bug.
Description Marcel de Rooy 2022-04-28 09:58:31 UTC
Originating from 20.11 warnings: Odd number of elements in anonymous hash at C4/Letters.pm line 878

output_pref({ dt => dt_from_string( $replacedby ), dateonly => $dateonly });

This is line 827 on current master.

If dt_from_string returns undef in list context, we get the odd number warn.

Also note the following lines:

if ( $letter->{ $letter_field } ) {
    $letter->{ $letter_field } =~ s/\Q<<$table.$field$filter_string_used>>\E/$replacedby_date/g;
    $letter->{ $letter_field } =~ s/\Q<<$field$filter_string_used>>\E/$replacedby_date/g;

If output_pref should correctly return undef on a NULL from dt_from_string, the undefined result triggers two warnings in the regexes.
Comment 1 Marcel de Rooy 2022-04-28 09:59:08 UTC
Probably related to 0000-00-00 in dateaccessioned. See 27768.
Comment 2 Marcel de Rooy 2022-04-28 10:07:48 UTC
Created attachment 134217 [details] [review]
Bug 30638: Resolve odd number in hash warn in Letters

Odd number of elements in anonymous hash at C4/Letters.pm line 827.

Trivial fix. Adding undefined check on result to prevent warns
on that one.

No test plan. Read the patch.

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Comment 3 Marcel de Rooy 2022-04-28 10:08:12 UTC
Trivial: self SO
Comment 4 Katrin Fischer 2022-05-06 09:11:27 UTC
This one had me puzzled a while ago - thx for the fix!
Comment 5 Katrin Fischer 2022-05-06 09:25:48 UTC
Created attachment 134717 [details] [review]
Bug 30638: Resolve odd number in hash warn in Letters

Odd number of elements in anonymous hash at C4/Letters.pm line 827.

Trivial fix. Adding undefined check on result to prevent warns
on that one.

No test plan. Read the patch.

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>

Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
Comment 6 Fridolin Somers 2022-05-06 20:35:05 UTC
Pushed to master for 22.05, thanks to everybody involved 🦄
Comment 7 Marcel de Rooy 2022-08-16 12:29:46 UTC
No interest for stable ?