Bug 18461: (bug 13757 follow-up) Do not mix decode_json and to_json
authorJonathan Druart <jonathan.druart@bugs.koha-community.org>
Mon, 24 Apr 2017 16:53:00 +0000 (13:53 -0300)
committerKyle M Hall <kyle@bywatersolutions.com>
Fri, 28 Apr 2017 10:24:23 +0000 (06:24 -0400)
commit475c294b292eadcc7e8d20307c16591fdf8b9b71
treeb940c0d636227fc4fae7ec7c1183bebed37ed9e0
parent11d4ad19aa765fdc22488a07eaca48cb4c965e4e
Bug 18461: (bug 13757 follow-up) Do not mix decode_json and to_json

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>

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Koha/Patron/Modification.pm
Koha/Patron/Modifications.pm