Bugzilla – Attachment 62667 Details for
Bug 18461
Internal server error while approving OPAC-edited patron attributes containing umlauts (äöü)
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 18461: (bug 13757 follow-up) Do not mix decode_json and to_json
Bug-18461-bug-13757-follow-up-Do-not-mix-decodejso.patch (text/plain), 2.67 KB, created by
Nick Clemens
on 2017-04-25 13:10:52 UTC
(
hide
)
Description:
Bug 18461: (bug 13757 follow-up) Do not mix decode_json and to_json
Filename:
MIME Type:
Creator:
Nick Clemens
Created:
2017-04-25 13:10:52 UTC
Size:
2.67 KB
patch
obsolete
>From 757377d32e01cacb7df063df884b2aa2e9c65c2b Mon Sep 17 00:00:00 2001 >From: Jonathan Druart <jonathan.druart@bugs.koha-community.org> >Date: Mon, 24 Apr 2017 13:53:00 -0300 >Subject: [PATCH] Bug 18461: (bug 13757 follow-up) Do not mix decode_json and > to_json >MIME-Version: 1.0 >Content-Type: text/plain; charset=UTF-8 >Content-Transfer-Encoding: 8bit > >Internal server error while approving OPAC-edited patron attributes >containing umlauts (äöü) > >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 > >To test: >- Reproduce problem above >- Apply patch >- Verify that Home > Patron > Update records displays without error >and 'New value' displays properly >- Approve! > >Also, run the tests: >- Run: > $ sudo koha-shell kohadev > k$ cd kohaclone > k$ prove t/db_dependent/Koha/Patron/Modifications.t >=> FAIL: Tests explode due to encoding problems in JSON handling >- Apply the patch >- Run the tests again: > k$ prove t/db_dependent/Koha/Patron/Modifications.t >=> SUCCESS: Tests pass! > >Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io> >Signed-off-by: Nick Clemens <nick@bywatersolutions.com> >--- > Koha/Patron/Modification.pm | 2 +- > Koha/Patron/Modifications.pm | 2 +- > 2 files changed, 2 insertions(+), 2 deletions(-) > >diff --git a/Koha/Patron/Modification.pm b/Koha/Patron/Modification.pm >index 78f092d..0fb1d0b 100644 >--- a/Koha/Patron/Modification.pm >+++ b/Koha/Patron/Modification.pm >@@ -104,7 +104,7 @@ sub approve { > > # Take care of extended attributes > if ( $self->extended_attributes ) { >- $extended_attributes = try { decode_json( $self->extended_attributes ) } >+ $extended_attributes = try { from_json( $self->extended_attributes ) } > catch { > Koha::Exceptions::Patron::Modification::InvalidData->throw( > 'The passed extended_attributes is not valid JSON'); >diff --git a/Koha/Patron/Modifications.pm b/Koha/Patron/Modifications.pm >index 403b955..5e7ed9e 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 = from_json( $row->{$key} ); > my @pending_attributes; > foreach my $attr ( @{$attributes} ) { > push @pending_attributes, >-- >2.1.4
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 18461
:
62538
|
62569
|
62617
|
62631
|
62632
|
62666
| 62667