From 9dc668740a20e2e5ab698b00c4286d8f6719db6e Mon Sep 17 00:00:00 2001 From: Tom Needham Date: Wed, 16 Jan 2013 21:46:00 +0000 Subject: [PATCH] Check that api methods return the correct result type --- lib/api.php | 3 +++ 1 file changed, 3 insertions(+) diff --git a/lib/api.php b/lib/api.php index e0097a7abf8..7722c744483 100644 --- a/lib/api.php +++ b/lib/api.php @@ -90,6 +90,9 @@ class OC_API { if(self::isAuthorised(self::$actions[$name])) { if(is_callable(self::$actions[$name]['action'])) { $response = call_user_func(self::$actions[$name]['action'], $parameters); + if(!($response instanceof OC_OCS_Result)){ + $response = new OC_OCS_Result(null, 996, 'Internal Server Error'); + } } else { $response = new OC_OCS_Result(null, 998, 'Api method not found'); }