mirror of
https://github.com/kamilwylegala/cakephp2-php8.git
synced 2024-11-15 03:18:26 +00:00
Add class_exists() check for view class.
Check that the view class hasn't already been mapped in the autoloader before mapping it. This allows developers to map view classes from plugins. Fixes #2684
This commit is contained in:
parent
3e0294a695
commit
f1931e43ef
1 changed files with 5 additions and 3 deletions
|
@ -581,9 +581,11 @@ class RequestHandlerComponent extends Component {
|
|||
$controller->ext = '.ctp';
|
||||
|
||||
$viewClass = Inflector::classify($type);
|
||||
App::uses($viewClass . 'View', 'View');
|
||||
|
||||
if (class_exists($viewClass . 'View')) {
|
||||
$viewName = $viewClass . 'View';
|
||||
if (!class_exists($viewName)) {
|
||||
App::uses($viewName, 'View');
|
||||
}
|
||||
if (class_exists($viewName)) {
|
||||
$controller->viewClass = $viewClass;
|
||||
} elseif (empty($this->_renderType)) {
|
||||
$controller->viewPath .= DS . $type;
|
||||
|
|
Loading…
Reference in a new issue