From 062d24f1011acbb4898ea39962e7ab01ac685f73 Mon Sep 17 00:00:00 2001 From: Martin Renvoize Date: Wed, 25 Mar 2026 09:44:33 +0100 Subject: [PATCH] Bug 40136: (follow-up) Avoid DateTime inflation in _unblessed_for_log Switch from unblessed() to get_column() so that date/datetime column values are returned as raw ISO strings directly from DBIC's internal storage, without constructing DateTime objects that would only be immediately stringified. This makes _unblessed_for_log cheaper on every call, which is particularly noticeable in the test suite where BorrowersLog defaults to enabled and patron stores are frequent. Signed-off-by: Martin Renvoize --- Koha/Patron.pm | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/Koha/Patron.pm b/Koha/Patron.pm index 7531b3fbf0..7233b24f13 100644 --- a/Koha/Patron.pm +++ b/Koha/Patron.pm @@ -3755,16 +3755,16 @@ ISO string representation, and sensitive/noisy fields are excluded. sub _unblessed_for_log { my ($self) = @_; - my $data = $self->unblessed; - delete @{$data}{qw(password lastseen updated_on)}; - for my $key ( keys %$data ) { - if ( defined $data->{$key} && $data->{$key} ne '' ) { - $data->{$key} = "$data->{$key}" if blessed( $data->{$key} ); - } else { - delete $data->{$key}; - } + + # Use get_column rather than unblessed to avoid DBIC column inflation: + # date/datetime values are returned as raw ISO strings directly, without + # constructing DateTime objects that we would only immediately stringify. + my %data = map { $_ => $self->get_column($_) } $self->result_source->columns; + delete @data{qw(password lastseen updated_on)}; + for my $key ( keys %data ) { + delete $data{$key} unless defined $data{$key} && $data{$key} ne ''; } - return $data; + return \%data; } =head1 AUTHORS