Commit 7c2be495 by Qiang Xue

Fixes #3638: `yii\filters\HttpCache` does not work as expected when session is…

Fixes #3638: `yii\filters\HttpCache` does not work as expected when session is started before the filter
parent 86f06677
......@@ -43,6 +43,7 @@ Yii Framework 2 Change Log
- Bug #3583: Added typecast to auto value of primary key on insert of sql active record (cebe)
- Bug #3591: Fixed incomplete obsolete filling in i18n `MessageController::saveMessagesToDb()` (advsm)
- Bug #3601: Fixed the bug that the refresh URL was not generated correctly by `Captcha` (qiangxue, klevron)
- Bug #3638: `yii\filters\HttpCache` does not work as expected when session is started before the filter (qiangxue)
- Bug #3681: Fixed problem with AR::findOne() when a default scope joins another table so that PK name becomes ambigous (cebe)
- Bug #3715: Fixed the bug that using a custom pager/sorter with `GridView` may generate two different pagers/sorters if the layout configures two pagers/sorters (qiangxue)
- Bug #3716: `DynamicModel::validateData()` does not call `validate()` if the `$rules` parameter is empty (qiangxue)
......
......@@ -164,6 +164,12 @@ class HttpCache extends ActionFilter
protected function sendCacheControlHeader()
{
if ($this->sessionCacheLimiter !== null) {
if ($this->sessionCacheLimiter === '' && !headers_sent() && Yii::$app->getSession()->getIsActive()) {
header_remove('Expires');
header_remove('Cache-Control');
header_remove('Last-Modified');
header_remove('Pragma');
}
session_cache_limiter($this->sessionCacheLimiter);
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment