Bugzilla – Attachment 187183 Details for
Bug 40915
SIP message parsing with empty fields edge cases
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 40915: Add enhanced debug logging for empty critical fields in SIP message parsing
Bug-40915-Add-enhanced-debug-logging-for-empty-cri.patch (text/plain), 2.50 KB, created by
Kyle M Hall (khall)
on 2025-10-01 11:59:10 UTC
(
hide
)
Description:
Bug 40915: Add enhanced debug logging for empty critical fields in SIP message parsing
Filename:
MIME Type:
Creator:
Kyle M Hall (khall)
Created:
2025-10-01 11:59:10 UTC
Size:
2.50 KB
patch
obsolete
>From 5b0ea0ba2b1dcd96000087f8063276ba83b8fffd Mon Sep 17 00:00:00 2001 >From: =?UTF-8?q?Tom=C3=A1s=20Cohen=20Arazi?= <tomascohen@theke.io> >Date: Tue, 30 Sep 2025 16:33:19 -0300 >Subject: [PATCH] Bug 40915: Add enhanced debug logging for empty critical > fields in SIP message parsing > >This patch adds debug logging to C4::SIP::Sip::MsgType::_initialize() to help >identify when critical fields (patron_id, item_id) are parsed as empty values. > >Empty critical fields in SIP messages can later cause DBIx::Class constraint >errors when passed to Koha::Objects->find() operations, generating confusing >'Odd number of elements in anonymous hash' errors in SIP server logs. > >The enhanced logging helps administrators identify the root cause by logging >when empty patron_id or item_id fields are detected during message parsing. > >To test: >1. Apply regression tests patch first >2. Run: > $ ktd --shell > k$ prove t/db_dependent/SIP/MsgType.t >=> FAIL: Debug logging tests fail (no enhanced logging present) >3. Apply this patch >4. Run: > $ ktd --shell > k$ prove t/db_dependent/SIP/MsgType.t >=> SUCCESS: All tests pass, debug logging works correctly >5. Sign off :-D > >Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com> >--- > C4/SIP/Sip/MsgType.pm | 18 +++++++++++++++++- > 1 file changed, 17 insertions(+), 1 deletion(-) > >diff --git a/C4/SIP/Sip/MsgType.pm b/C4/SIP/Sip/MsgType.pm >index 3ae395d3bd1..9f1cdd54602 100644 >--- a/C4/SIP/Sip/MsgType.pm >+++ b/C4/SIP/Sip/MsgType.pm >@@ -352,7 +352,23 @@ sub _initialize { > $self->{fields}->{$fn}, $self->{name}, $msg > ); > } else { >- $self->{fields}->{$fn} = substr( $field, 2 ); >+ my $field_value = substr( $field, 2 ); >+ $self->{fields}->{$fn} = $field_value; >+ >+ # Enhanced debug logging for empty critical fields that could cause constraint errors >+ if ( defined $field_value && $field_value eq '' ) { >+ if ( $fn eq FID_PATRON_ID ) { >+ siplog( >+ "LOG_DEBUG", "Empty patron_id detected in %s message - could cause constraint errors", >+ $self->{name} >+ ); >+ } elsif ( $fn eq FID_ITEM_ID ) { >+ siplog( >+ "LOG_DEBUG", "Empty item_id detected in %s message - could cause constraint errors", >+ $self->{name} >+ ); >+ } >+ } > } > } > >-- >2.39.5 (Apple Git-154)
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 40915
:
187120
|
187121
|
187182
|
187183
|
187667
|
187668