summaryrefslogtreecommitdiff
path: root/modules/rest
diff options
context:
space:
mode:
Diffstat (limited to 'modules/rest')
-rw-r--r--modules/rest/controllers/rest.php2
-rw-r--r--modules/rest/helpers/rest.php6
2 files changed, 4 insertions, 4 deletions
diff --git a/modules/rest/controllers/rest.php b/modules/rest/controllers/rest.php
index 54ca6fe9..b3d59e0f 100644
--- a/modules/rest/controllers/rest.php
+++ b/modules/rest/controllers/rest.php
@@ -98,7 +98,7 @@ class Rest_Controller extends Controller {
$handler_class = "{$function}_rest";
$handler_method = $request->method;
- if (!method_exists($handler_class, $handler_method)) {
+ if (!class_exists($handler_class) || !method_exists($handler_class, $handler_method)) {
throw new Rest_Exception("Bad Request", 400);
}
diff --git a/modules/rest/helpers/rest.php b/modules/rest/helpers/rest.php
index 9b367feb..c6be1e1d 100644
--- a/modules/rest/helpers/rest.php
+++ b/modules/rest/helpers/rest.php
@@ -141,7 +141,7 @@ class rest_Core {
}
$class = "$components[1]_rest";
- if (!method_exists($class, "resolve")) {
+ if (!class_exists($class) || !method_exists($class, "resolve")) {
throw new Kohana_404_Exception($url);
}
@@ -158,7 +158,7 @@ class rest_Core {
$resource_type = array_shift($args);
$class = "{$resource_type}_rest";
- if (!method_exists($class, "url")) {
+ if (!class_exists($class) || !method_exists($class, "url")) {
throw new Rest_Exception("Bad Request", 400);
}
@@ -178,7 +178,7 @@ class rest_Core {
foreach (module::active() as $module) {
foreach (glob(MODPATH . "{$module->name}/helpers/*_rest.php") as $filename) {
$class = str_replace(".php", "", basename($filename));
- if (method_exists($class, "relationships")) {
+ if (class_exists($class) && method_exists($class, "relationships")) {
if ($tmp = call_user_func(array($class, "relationships"), $resource_type, $resource)) {
$results = array_merge($results, $tmp);
}