From aeb9646445b3cef659ce60b343b38c80015db5c0 Mon Sep 17 00:00:00 2001 From: Yorhel Date: Fri, 2 Jan 2015 11:36:46 +0100 Subject: staff: Don't allow empty staff revisions --- lib/VNDB/Func.pm | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) (limited to 'lib/VNDB/Func.pm') diff --git a/lib/VNDB/Func.pm b/lib/VNDB/Func.pm index 3b315c93..ac9fdd58 100644 --- a/lib/VNDB/Func.pm +++ b/lib/VNDB/Func.pm @@ -204,16 +204,18 @@ sub fmtvote { } -my $JSON; # cache +# JSON::XS::encode_json converts input to utf8, whereas the below functions +# operate on wide character strings. Canonicalization is enabled to allow for +# proper comparison of serialized objects. +my $JSON = JSON::XS->new; +$JSON->canonical(1); -# JSON::XS::encode_json converts input to utf8, whereas these functions -# operate on wide character strings. sub jsonEncode ($) { - ($JSON ||= JSON::XS->new)->encode(@_); + $JSON->encode(@_); } sub jsonDecode ($) { - ($JSON ||= JSON::XS->new)->decode(@_); + $JSON->decode(@_); } # Insert JSON-encoded data as script, arguments: id, object -- cgit v1.2.3