From: David Lawrence Date: Fri, 10 Apr 2015 13:30:09 +0000 (+0100) Subject: Bug 1152319: calling /rest/logout results in an internal error and a malformed respon... X-Git-Tag: bugzilla-5.0rc3~12 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=ee238ab3729d8cfe9d0a5fa66fbf0433679cef3c;p=thirdparty%2Fbugzilla.git Bug 1152319: calling /rest/logout results in an internal error and a malformed response to the caller r=glob,a=glob --- diff --git a/Bugzilla/WebService/Server/REST.pm b/Bugzilla/WebService/Server/REST.pm index b3d35595f7..cefebd65d1 100644 --- a/Bugzilla/WebService/Server/REST.pm +++ b/Bugzilla/WebService/Server/REST.pm @@ -130,6 +130,16 @@ sub response { $result = $json_data->{result}; } + # The result needs to be a valid JSON data structure + # and not a undefined or scalar value. + if (!ref $result + || blessed($result) + || ref $result ne 'HASH' + || ref $result ne 'ARRAY') + { + $result = { result => $result }; + } + Bugzilla::Hook::process('webservice_rest_response', { rpc => $self, result => \$result, response => $response });