mirror of
https://github.com/kamilwylegala/cakephp2-php8.git
synced 2024-11-15 03:18:26 +00:00
Refactoring Dispatcher::_isPrivate to directly check for controller methods, doing in in the controller could be unnecessary
This commit is contained in:
parent
1d67d1611c
commit
c431ddd22c
2 changed files with 4 additions and 7 deletions
|
@ -308,15 +308,12 @@ class Controller extends Object {
|
|||
}
|
||||
if (empty($this->uses)) {
|
||||
$this->modelClass = Inflector::singularize($this->name);
|
||||
} else {
|
||||
$this->modelClass = current($this->uses);
|
||||
}
|
||||
$this->modelKey = Inflector::underscore($this->modelClass);
|
||||
$this->Components = new ComponentCollection();
|
||||
|
||||
$childMethods = get_class_methods($this);
|
||||
$parentMethods = get_class_methods('Controller');
|
||||
|
||||
$this->methods = array_diff($childMethods, $parentMethods);
|
||||
|
||||
if ($request instanceof CakeRequest) {
|
||||
$this->_setRequest($request);
|
||||
}
|
||||
|
|
|
@ -143,7 +143,7 @@ class Dispatcher {
|
|||
$privateAction = in_array($prefix, $prefixes);
|
||||
}
|
||||
}
|
||||
return $privateAction;
|
||||
return $privateAction && ! in_array($request->params['action'], get_class_methods('Controller'));
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -160,7 +160,7 @@ class Dispatcher {
|
|||
$controller->constructClasses();
|
||||
$controller->startupProcess();
|
||||
|
||||
$methods = array_flip($controller->methods);
|
||||
$methods = array_flip(get_class_methods($controller));
|
||||
|
||||
if (!isset($methods[$request->params['action']])) {
|
||||
if ($controller->scaffold !== false) {
|
||||
|
|
Loading…
Reference in a new issue