From fbd7eded2dba548230eec177b8cde623e788b9e0 Mon Sep 17 00:00:00 2001 From: Alexander Makarov Date: Thu, 26 Mar 2020 23:21:35 +0300 Subject: [PATCH] Bug #17933: Log warning instead of erroring when URLManager is unable to initialize cache --- framework/CHANGELOG.md | 1 + framework/base/Application.php | 2 +- framework/web/UrlManager.php | 6 +++++- 3 files changed, 7 insertions(+), 2 deletions(-) diff --git a/framework/CHANGELOG.md b/framework/CHANGELOG.md index 0514cf08a8..ffd87f48a3 100644 --- a/framework/CHANGELOG.md +++ b/framework/CHANGELOG.md @@ -4,6 +4,7 @@ Yii Framework 2 Change Log 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 #17932: Fix regression in detection of AJAX requests (samdark) - Bug #17934: Fix regression in Oracle when binding several string parameters (fen1xpv, samdark) diff --git a/framework/base/Application.php b/framework/base/Application.php index d7771bf636..9e5a86910c 100644 --- a/framework/base/Application.php +++ b/framework/base/Application.php @@ -631,7 +631,7 @@ abstract class Application extends Module 'mailer' => ['class' => 'yii\swiftmailer\Mailer'], 'urlManager' => ['class' => 'yii\web\UrlManager'], 'assetManager' => ['class' => 'yii\web\AssetManager'], - 'security' => ['class' => 'yii\base\Security'], + 'security' => ['class' => 'yii\base\Security'] ]; } diff --git a/framework/web/UrlManager.php b/framework/web/UrlManager.php index 30fa865dcc..ce6ddb3f66 100644 --- a/framework/web/UrlManager.php +++ b/framework/web/UrlManager.php @@ -186,7 +186,11 @@ class UrlManager extends Component return; } 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)) { return;