Check that api methods return the correct result type

This commit is contained in:
Tom Needham 2013-01-16 21:46:00 +00:00
parent 358671ac1d
commit 9dc668740a
1 changed files with 3 additions and 0 deletions

View File

@ -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');
}