Fixes #1965: Controller::findLayoutFile() returns incorrect file path when layout name starts with a slash

This commit is contained in:
Qiang Xue
2014-01-14 08:29:47 -05:00
parent 8ede55a0df
commit aa5e82ec07
2 changed files with 2 additions and 1 deletions

View File

@ -400,7 +400,7 @@ class Controller extends Component implements ViewContextInterface
if (strncmp($layout, '@', 1) === 0) {
$file = Yii::getAlias($layout);
} elseif (strncmp($layout, '/', 1) === 0) {
$file = Yii::$app->getLayoutPath() . DIRECTORY_SEPARATOR . $layout;
$file = Yii::$app->getLayoutPath() . DIRECTORY_SEPARATOR . substr($layout, 1);
} else {
$file = $module->getLayoutPath() . DIRECTORY_SEPARATOR . $layout;
}