From ee238ab3729d8cfe9d0a5fa66fbf0433679cef3c Mon Sep 17 00:00:00 2001 From: David Lawrence Date: Fri, 10 Apr 2015 14:30:09 +0100 Subject: [PATCH] Bug 1152319: calling /rest/logout results in an internal error and a malformed response to the caller r=glob,a=glob --- Bugzilla/WebService/Server/REST.pm | 10 ++++++++++ 1 file changed, 10 insertions(+) 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 }); -- 2.47.2