Bladeren bron

[HttpFoundation] removed the possibility for a cookie path to set it to null (as this is equivalent to /)

Fabien Potencier 13 jaren geleden
bovenliggende
commit
1e7e6ba305

+ 2 - 2
src/Symfony/Component/HttpFoundation/Cookie.php

@@ -90,7 +90,7 @@ class Cookie
             }
         }
 
-        if (null !== $this->getPath()) {
+        if ('/' !== $this->getPath()) {
             $str .= '; path='.$this->getPath();
         }
 
@@ -166,7 +166,7 @@ class Cookie
      */
     public function getPath()
     {
-        return $this->path;
+        return null === $this->path ? '/' : $this->path;
     }
 
     /**

+ 4 - 0
src/Symfony/Component/HttpFoundation/ResponseHeaderBag.php

@@ -141,6 +141,10 @@ class ResponseHeaderBag extends HeaderBag
      */
     public function removeCookie($name, $path = '/', $domain = null)
     {
+        if (null === $path) {
+            $path = '/';
+        }
+
         unset($this->cookies[$domain][$path][$name]);
 
         if (empty($this->cookies[$domain][$path])) {