Fix #18426: Fix check for route's leading slash in yii\widgets\Menu

This commit is contained in:
stevekr
2020-12-09 13:05:26 +02:00
committed by GitHub
parent 7c7c7148f6
commit 98533b7e31
2 changed files with 2 additions and 1 deletions

View File

@ -12,6 +12,7 @@ Yii Framework 2 Change Log
- Enh #18394: Add support for setting `yii\web\Response::$stream` to a callable (brandonkelly)
- Bug #18406: Fix PDO exception when committing or rolling back an autocommitted transaction in PHP 8 (brandonkelly)
- Bug #18287: Fix the OUTPUT got SQL syntax error if the column name is MSSQL keyword e.g key (darkdef)
- Bug #18426: Fix check for route's leading slash in `yii\widgets\Menu` (stevekr)
2.0.39.3 November 23, 2020

View File

@ -306,7 +306,7 @@ class Menu extends Widget
{
if (isset($item['url']) && is_array($item['url']) && isset($item['url'][0])) {
$route = Yii::getAlias($item['url'][0]);
if ($route[0] !== '/' && Yii::$app->controller) {
if (substr($route, 0, 1) !== '/' && Yii::$app->controller) {
$route = Yii::$app->controller->module->getUniqueId() . '/' . $route;
}
if (ltrim($route, '/') !== $this->route) {