]> git.ipfire.org Git - thirdparty/bugzilla.git/commitdiff
Bug 1152319: calling /rest/logout results in an internal error and a malformed respon...
authorDavid Lawrence <dkl@mozilla.com>
Fri, 10 Apr 2015 13:30:09 +0000 (14:30 +0100)
committerDavid Lawrence <dkl@mozilla.com>
Fri, 10 Apr 2015 13:30:09 +0000 (14:30 +0100)
r=glob,a=glob

Bugzilla/WebService/Server/REST.pm

index b3d35595f7837fbc0c6b6842c9e1c20cb07a8abc..cefebd65d118cd856d23a09f3c51c59107cdd3d0 100644 (file)
@@ -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 });