Browse Source

Fixed HttpCache was sending an empty Pragma header (#12100) (#12123)

tags/2.0.10
Sergey Makinen 8 years ago committed by Carsten Brandt
parent
commit
afc298c6ef
  1. 1
      framework/CHANGELOG.md
  2. 1
      framework/filters/HttpCache.php
  3. 12
      tests/framework/filters/HttpCacheTest.php

1
framework/CHANGELOG.md

@ -30,6 +30,7 @@ Yii Framework 2 Change Log
- Bug #12053: `./yii migrate/create` was generating wrong code when using `bigPrimaryKey` (VojtechH, samdark) - Bug #12053: `./yii migrate/create` was generating wrong code when using `bigPrimaryKey` (VojtechH, samdark)
- Bug #11907: Fixed `yii\helpers\Console::getScreenSize()` on Windows was giving out width and height swapped (Spell6inder, samdark, cebe) - Bug #11907: Fixed `yii\helpers\Console::getScreenSize()` on Windows was giving out width and height swapped (Spell6inder, samdark, cebe)
- Bug #11973: Fixed `yii\helpers\BaseHtml::getAttributeValue()` to work with `items[]` notation correctly (silverfire) - Bug #11973: Fixed `yii\helpers\BaseHtml::getAttributeValue()` to work with `items[]` notation correctly (silverfire)
- Bug #12100: Fixed `yii\filters\HttpCache` was sending an empty Pragma header (sergeymakinen)
- Bug #12107: Fixed REST Serializer to validate input for 'expand' and 'fields' parameter, which crashed on array input (njspok, cebe) - Bug #12107: Fixed REST Serializer to validate input for 'expand' and 'fields' parameter, which crashed on array input (njspok, cebe)

1
framework/filters/HttpCache.php

@ -193,7 +193,6 @@ class HttpCache extends ActionFilter
} }
$headers = Yii::$app->getResponse()->getHeaders(); $headers = Yii::$app->getResponse()->getHeaders();
$headers->set('Pragma');
if ($this->cacheControlHeader !== null) { if ($this->cacheControlHeader !== null) {
$headers->set('Cache-Control', $this->cacheControlHeader); $headers->set('Cache-Control', $this->cacheControlHeader);

12
tests/framework/filters/HttpCacheTest.php

@ -28,6 +28,18 @@ class HttpCacheTest extends \yiiunit\TestCase
$this->assertTrue($httpCache->beforeAction(null)); $this->assertTrue($httpCache->beforeAction(null));
} }
public function testEmptyPragma()
{
$httpCache = new HttpCache;
$httpCache->etagSeed = function($action, $params) {
return '';
};
$httpCache->beforeAction(null);
$response = Yii::$app->getResponse();
$this->assertFalse($response->getHeaders()->offsetExists('Pragma'));
$this->assertFalse($response->getHeaders()->get('Pragma') === '');
}
/** /**
* @covers yii\filters\HttpCache::validateCache * @covers yii\filters\HttpCache::validateCache
*/ */

Loading…
Cancel
Save