Adding trigger_error for incorrect class use.

This commit is contained in:
mark_story 2009-12-03 21:29:02 -05:00
parent 0047ac8f34
commit 626f2e86de

View file

@ -280,7 +280,12 @@ class Router {
$routeClass = $options['routeClass'];
unset($options['routeClass']);
}
$self->routes[] =& new $routeClass($route, $defaults, $options);
$Route =& new $routeClass($route, $defaults, $options);
if ($routeClass !== 'CakeRoute' && !is_subclass_of($Route, 'CakeRoute')) {
trigger_error(__('Route classes must extend CakeRoute', true), E_USER_WARNING);
return false;
}
$self->routes[] =& $Route;
return $self->routes;
}