From 1e7e6ba305c4b7b66e49545d582325ed1ea5f9d7 Mon Sep 17 00:00:00 2001 From: Fabien Potencier Date: Wed, 28 Sep 2011 10:34:14 +0200 Subject: [PATCH] [HttpFoundation] removed the possibility for a cookie path to set it to null (as this is equivalent to /) --- src/Symfony/Component/HttpFoundation/Cookie.php | 4 ++-- src/Symfony/Component/HttpFoundation/ResponseHeaderBag.php | 4 ++++ 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/src/Symfony/Component/HttpFoundation/Cookie.php b/src/Symfony/Component/HttpFoundation/Cookie.php index 9dab8e6df49f..339e78d4065e 100644 --- a/src/Symfony/Component/HttpFoundation/Cookie.php +++ b/src/Symfony/Component/HttpFoundation/Cookie.php @@ -90,7 +90,7 @@ public function __toString() } } - if (null !== $this->getPath()) { + if ('/' !== $this->getPath()) { $str .= '; path='.$this->getPath(); } @@ -166,7 +166,7 @@ public function getExpiresTime() */ public function getPath() { - return $this->path; + return null === $this->path ? '/' : $this->path; } /** diff --git a/src/Symfony/Component/HttpFoundation/ResponseHeaderBag.php b/src/Symfony/Component/HttpFoundation/ResponseHeaderBag.php index 26017f1cfa46..f243dcc9f6bb 100644 --- a/src/Symfony/Component/HttpFoundation/ResponseHeaderBag.php +++ b/src/Symfony/Component/HttpFoundation/ResponseHeaderBag.php @@ -141,6 +141,10 @@ public function setCookie(Cookie $cookie) */ public function removeCookie($name, $path = '/', $domain = null) { + if (null === $path) { + $path = '/'; + } + unset($this->cookies[$domain][$path][$name]); if (empty($this->cookies[$domain][$path])) {