From 396bd9f7144c7d9ae73ccc41c6c9f358a07b8e7f Mon Sep 17 00:00:00 2001 From: Juuso Leinonen Date: Wed, 2 Dec 2015 14:34:30 +0000 Subject: [PATCH] Fixes #10309: Extracted `yii\web\UrlManager` rule cache key into `$cacheKey` protected property --- framework/CHANGELOG.md | 1 + framework/web/UrlManager.php | 8 +++++++- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/framework/CHANGELOG.md b/framework/CHANGELOG.md index 1e38eed..30129ba 100644 --- a/framework/CHANGELOG.md +++ b/framework/CHANGELOG.md @@ -211,6 +211,7 @@ Yii Framework 2 Change Log - Enh #10255: Added Yii warning to session initialization if session was already started (AnatolyRugalev) - Enh #10264: Generation of HTML tags in Yii's JavaScript now uses jQuery style (silverfire) - Enh #10267: `yii.js` - added original event passing to `pjaxOptions` for links with `data-method` and `data-pjax` (servocoder, silverfire) +- Enh #10309: Extracted `yii\web\UrlManager` rule cache key into `$cacheKey` protected property (lordthorzonus) - Enh #10319: `yii\helpers\VarDumper::dump()` now respects PHP magic method `__debugInfo()` (klimov-paul) - Enh #10359: Support wildcard category name in `yii/console/controllers/MessageController` (rmrevin) - Enh #10390: Added ability to disable outer tag for `\yii\helpers\BaseHtml::radiolist()`, `::checkboxList()` (TianJinRong, githubjeka, silverfire) diff --git a/framework/web/UrlManager.php b/framework/web/UrlManager.php index a632ba0..fd772d7 100644 --- a/framework/web/UrlManager.php +++ b/framework/web/UrlManager.php @@ -126,6 +126,12 @@ class UrlManager extends Component */ public $ruleConfig = ['class' => 'yii\web\UrlRule']; + /** + * @var string the cache key for cached rules + * @since 2.0.8 + */ + protected $cacheKey = __CLASS__; + private $_baseUrl; private $_scriptUrl; private $_hostInfo; @@ -146,7 +152,7 @@ class UrlManager extends Component $this->cache = Yii::$app->get($this->cache, false); } if ($this->cache instanceof Cache) { - $cacheKey = __CLASS__; + $cacheKey = $this->cacheKey; $hash = md5(json_encode($this->rules)); if (($data = $this->cache->get($cacheKey)) !== false && isset($data[1]) && $data[1] === $hash) { $this->rules = $data[0];