Bug #17933: Log warning instead of erroring when URLManager is unable to initialize cache

This commit is contained in:
octicon-git-branch(16/)
octicon-tag(16/)
Alexander Makarov
2020-03-26 23:21:35 +03:00
committed by GitHub
gitea-unlock(16/)
parent f8d417c42a
commit fbd7eded2d
octicon-diff(16/tw-mr-1) 3 changed files with 7 additions and 2 deletions

1
framework/CHANGELOG.md
View File

@@ -4,6 +4,7 @@ Yii Framework 2 Change Log
2.0.34 under development 2.0.34 under development
------------------------ ------------------------
- Bug #17933: Log warning instead of erroring when URLManager is unable to initialize cache (samdark)
- Bug #17935: Reset DB quoted table/column name caches when the connection is closed (brandonkelly) - Bug #17935: Reset DB quoted table/column name caches when the connection is closed (brandonkelly)
- Bug #17932: Fix regression in detection of AJAX requests (samdark) - Bug #17932: Fix regression in detection of AJAX requests (samdark)
- Bug #17934: Fix regression in Oracle when binding several string parameters (fen1xpv, samdark) - Bug #17934: Fix regression in Oracle when binding several string parameters (fen1xpv, samdark)

2
framework/base/Application.php
View File

@@ -631,7 +631,7 @@ abstract class Application extends Module
'mailer' => ['class' => 'yii\swiftmailer\Mailer'], 'mailer' => ['class' => 'yii\swiftmailer\Mailer'],
'urlManager' => ['class' => 'yii\web\UrlManager'], 'urlManager' => ['class' => 'yii\web\UrlManager'],
'assetManager' => ['class' => 'yii\web\AssetManager'], 'assetManager' => ['class' => 'yii\web\AssetManager'],
'security' => ['class' => 'yii\base\Security'], 'security' => ['class' => 'yii\base\Security']
]; ];
} }

6
framework/web/UrlManager.php
View File

@@ -186,7 +186,11 @@ class UrlManager extends Component
return; return;
} }
if ($this->cache !== false && $this->cache !== null) { if ($this->cache !== false && $this->cache !== null) {
$this->cache = Instance::ensure($this->cache, 'yii\caching\CacheInterface'); try {
$this->cache = Instance::ensure($this->cache, 'yii\caching\CacheInterface');
} catch (InvalidConfigException $e) {
Yii::warning('Unable to use cache for URL manager: ' . $e->getMessage());
}
} }
if (empty($this->rules)) { if (empty($this->rules)) {
return; return;