From 253bb83893ad88f409ee78415ec4ef720413cbcf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marc=20V=C3=A9ron?= Date: Fri, 21 Apr 2017 18:21:53 +0200 Subject: [PATCH] =?UTF-8?q?Bug=2018461:=20Internal=20server=20error=20whil?= =?UTF-8?q?e=20approving=20OPAC-edited=20patron=20attributes=20containing?= =?UTF-8?q?=20umlauts=20(=C3=A4=C3=B6=C3=BC)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit If a OPAC user enters text containing umlauts (äöü) in a patron atribute and saves it, the Staff client will get an inernal server error in members-update.pl (approving). E.g. a text like 111ä222 leads to the following in plack error log: malformed UTF-8 character in JSON string, at character offset 14 (before "\x{fffd}2","code":"T...") at (...)/Koha/Patron/Modifications.pm line 100. To test: - Reproduce problem above - Apply patch - Verify that Home > Patron > Update records displays without error and 'New value' displays properly Followed test plan and it works as intended Signed-off-by: Alex Buckley --- Koha/Patron/Modifications.pm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Koha/Patron/Modifications.pm b/Koha/Patron/Modifications.pm index 403b955..3c683b4 100644 --- a/Koha/Patron/Modifications.pm +++ b/Koha/Patron/Modifications.pm @@ -97,7 +97,7 @@ sub pending { while ( my $row = $sth->fetchrow_hashref() ) { foreach my $key ( keys %$row ) { if ( defined $row->{$key} && $key eq 'extended_attributes' ) { - my $attributes = decode_json( $row->{$key} ); + my $attributes = JSON->new->utf8(0)->decode( $row->{$key} ); my @pending_attributes; foreach my $attr ( @{$attributes} ) { push @pending_attributes, -- 2.1.4