Bug 40386 - t/Edifact.t generates warnings
Summary: t/Edifact.t generates warnings
Status: Pushed to stable
Alias: None
Product: Koha
Classification: Unclassified
Component: Test Suite (show other bugs)
Version: unspecified
Hardware: All All
: P5 - low minor
Assignee: Martin Renvoize (ashimema)
QA Contact: Jonathan Druart
URL:
Keywords:
Depends on:
Blocks: 40387
  Show dependency treegraph
 
Reported: 2025-07-15 12:39 UTC by Jonathan Druart
Modified: 2025-08-22 08:29 UTC (History)
1 user (show)

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


Attachments
Bug 40386: Remove warnings from EDI when running tests (2.61 KB, patch)
2025-07-18 12:33 UTC, Martin Renvoize (ashimema)
Details | Diff | Splinter Review
Bug 40386: Remove warnings from EDI when running tests (2.69 KB, patch)
2025-07-23 12:35 UTC, Jonathan Druart
Details | Diff | Splinter Review

Note You need to log in before you can comment on or make changes to this bug.
Description Jonathan Druart 2025-07-15 12:39:10 UTC
03:28:19 koha_1       | substr outside of string at /kohadevbox/koha/Koha/Edifact/Segment.pm line 101.
03:28:19 koha_1       | Use of uninitialized value $seg in substitution (s///) at /kohadevbox/koha/Koha/Edifact/Segment.pm line 103.
03:28:19 koha_1       | Use of uninitialized value $seg in split at /kohadevbox/koha/Koha/Edifact/Segment.pm line 104.
Comment 1 Martin Renvoize (ashimema) 2025-07-18 12:33:21 UTC
Created attachment 184374 [details] [review]
Bug 40386: Remove warnings from EDI when running tests

This patch fixes several warnings that occur when running Edifact tests:

1. Changed `my $self = ()` to `my $self = {}` in Koha::Edifact constructor
   to properly initialize as hashref instead of empty list
2. Added null/empty checks in Koha::Edifact::Segment::_parse_seg() to prevent
   warnings when processing undefined or empty segments
3. Added null/empty checks in Koha::Edifact::Segment::_get_elements() to
   handle undefined segments gracefully
4. Added Test::NoWarnings to t/Edifact.t to catch any remaining warnings

These changes eliminate "Use of uninitialized value" warnings and ensure
clean test runs without affecting EDI functionality.

Test plan:
1. Run prove t/Edifact.t and verify no warnings are displayed
2. Test EDI message processing to ensure no regression
Comment 2 Jonathan Druart 2025-07-23 12:35:46 UTC
Created attachment 184549 [details] [review]
Bug 40386: Remove warnings from EDI when running tests

This patch fixes several warnings that occur when running Edifact tests:

1. Changed `my $self = ()` to `my $self = {}` in Koha::Edifact constructor
   to properly initialize as hashref instead of empty list
2. Added null/empty checks in Koha::Edifact::Segment::_parse_seg() to prevent
   warnings when processing undefined or empty segments
3. Added null/empty checks in Koha::Edifact::Segment::_get_elements() to
   handle undefined segments gracefully
4. Added Test::NoWarnings to t/Edifact.t to catch any remaining warnings

These changes eliminate "Use of uninitialized value" warnings and ensure
clean test runs without affecting EDI functionality.

Test plan:
1. Run prove t/Edifact.t and verify no warnings are displayed
2. Test EDI message processing to ensure no regression

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Comment 3 Lucas Gass (lukeg) 2025-07-23 22:42:17 UTC
Nice work everyone!

Pushed to main for 25.11
Comment 4 Paul Derscheid 2025-08-22 08:29:35 UTC
Nice work everyone!

Pushed to 25.05.x