Bugzilla – Attachment 145239 Details for
Bug 32615
Don't crash on empty yaml sysprefs
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 32615: Don't crash on empty yaml sysprefs
Bug-32615-Dont-crash-on-empty-yaml-sysprefs.patch (text/plain), 1.17 KB, created by
David Gustafsson
on 2023-01-12 16:54:50 UTC
(
hide
)
Description:
Bug 32615: Don't crash on empty yaml sysprefs
Filename:
MIME Type:
Creator:
David Gustafsson
Created:
2023-01-12 16:54:50 UTC
Size:
1.17 KB
patch
obsolete
>From 4aabe3d55bcdfa2a30562e679961482624327b49 Mon Sep 17 00:00:00 2001 >From: David Gustafsson <david.gustafsson@ub.gu.se> >Date: Thu, 12 Jan 2023 17:44:01 +0100 >Subject: [PATCH] Bug 32615: Don't crash on empty yaml sysprefs > >To test: > 1) Apply patch > 2) Verify tests in t/Context.t pass >--- > C4/Context.pm | 14 ++++++++------ > 1 file changed, 8 insertions(+), 6 deletions(-) > >diff --git a/C4/Context.pm b/C4/Context.pm >index 1aec1232f3..77e38db581 100644 >--- a/C4/Context.pm >+++ b/C4/Context.pm >@@ -341,14 +341,16 @@ the value cannot be properly decoded as YAML. > > sub yaml_preference { > my ( $self, $preference ) = @_; >+ my $value = $self->preference( $preference ); >+ if ($value) { >+ my $yaml = eval { YAML::XS::Load( Encode::encode_utf8( $self->preference( $preference ) ) ); }; >+ if ($@) { >+ warn "Unable to parse $preference syspref : $@"; >+ return; >+ } > >- my $yaml = eval { YAML::XS::Load( Encode::encode_utf8( $self->preference( $preference ) ) ); }; >- if ($@) { >- warn "Unable to parse $preference syspref : $@"; >- return; >+ return $yaml; > } >- >- return $yaml; > } > > =head2 enable_syspref_cache >-- >2.35.1
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 32615
: 145239