From ff83a13d57a74edc9fc19ba244ba5fcc52dd1a74 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ond=C5=99ej=20Va=C5=A1=C3=AD=C4=8Dek?= Date: Mon, 30 Apr 2018 12:07:36 +0200 Subject: [PATCH] Fixes #16068: Fixed `yii\web\CookieCollection::has` when an expiration param is set to 'until the browser is closed' --- framework/CHANGELOG.md | 1 + framework/web/CookieCollection.php | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/framework/CHANGELOG.md b/framework/CHANGELOG.md index ea86aef55b..1c2703985b 100644 --- a/framework/CHANGELOG.md +++ b/framework/CHANGELOG.md @@ -4,6 +4,7 @@ Yii Framework 2 Change Log 2.0.16 under development ------------------------ +- Bug #16068: Fixed `yii\web\CookieCollection::has` when an expiration param is set to 'until the browser is closed' (OndrejVasicek) - Bug #16006: Handle case when `X-Forwarded-Host` header have multiple hosts separated with a comma (pgaultier) - Bug #16010: Fixed `yii\filters\ContentNegotiator` behavior when GET parameters contain an array (rugabarbo) - Bug #14660: Fixed `yii\caching\DbCache` concurrency issue when set values with the same key (rugabarbo) diff --git a/framework/web/CookieCollection.php b/framework/web/CookieCollection.php index 9000fc88ab..e5b2b688f1 100644 --- a/framework/web/CookieCollection.php +++ b/framework/web/CookieCollection.php @@ -113,7 +113,7 @@ class CookieCollection extends BaseObject implements \IteratorAggregate, \ArrayA public function has($name) { return isset($this->_cookies[$name]) && $this->_cookies[$name]->value !== '' - && ($this->_cookies[$name]->expire === null || $this->_cookies[$name]->expire >= time()); + && ($this->_cookies[$name]->expire === null || $this->_cookies[$name]->expire === 0 || $this->_cookies[$name]->expire >= time()); } /**