From 50b0ba401b1ee72c654be271eeeb67faaed19055 Mon Sep 17 00:00:00 2001 From: Martin Renvoize Date: Wed, 8 Jul 2026 12:24:24 +0100 Subject: [PATCH] Bug 35104: Guard Koha::Exceptions::Metadata::Invalid::full_message against undef fields full_message() interpolated id/biblionumber/format/schema/decoding_error directly into a sprintf without checking definedness, producing Perl warnings whenever one of them is unset (e.g. a new, not-yet-stored metadata object with no id yet). Signed-off-by: Baptiste Bayche Signed-off-by: Baptiste Wojtkowski Sponsored-by: OpenFifth Signed-off-by: Nick Clemens Signed-off-by: Pedro Amorim --- Koha/Exceptions/Metadata.pm | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Koha/Exceptions/Metadata.pm b/Koha/Exceptions/Metadata.pm index 75013885af..7d2e02ff1c 100644 --- a/Koha/Exceptions/Metadata.pm +++ b/Koha/Exceptions/Metadata.pm @@ -40,7 +40,8 @@ sub full_message { if ( $self->isa('Koha::Exceptions::Metadata::Invalid') ) { $msg = sprintf( "Invalid data, cannot decode metadata object (biblio_metadata.id=%s, biblionumber=%s, format=%s, schema=%s, decoding_error='%s')", - $self->id, $self->biblionumber, $self->format, $self->schema, $self->decoding_error + $self->id // '', $self->biblionumber // '', $self->format // '', $self->schema // '', + $self->decoding_error // '' ); } }