From 9dc668740a20e2e5ab698b00c4286d8f6719db6e Mon Sep 17 00:00:00 2001 From: Tom Needham Date: Wed, 16 Jan 2013 21:46:00 +0000 Subject: [PATCH 1/2] 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 e0097a7abf..7722c74448 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'); } From 8f9d3cd01d9cf253b88ac360c291bf361514742a Mon Sep 17 00:00:00 2001 From: Tom Needham Date: Wed, 23 Jan 2013 23:39:29 +0000 Subject: [PATCH 2/2] Code style update --- lib/api.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/api.php b/lib/api.php index 7722c74448..64b2f0fe9c 100644 --- a/lib/api.php +++ b/lib/api.php @@ -90,7 +90,7 @@ 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)){ + if(!($response instanceof OC_OCS_Result)) { $response = new OC_OCS_Result(null, 996, 'Internal Server Error'); } } else {